kingtest commited on
Commit
bb71ea7
·
verified ·
1 Parent(s): 6bd01c6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -39
Dockerfile CHANGED
@@ -1,45 +1,20 @@
1
- ############################################################################################
2
- #### SERVER
3
- ############################################################################################
4
-
5
- # Using the `rust-musl-builder` as base image, instead of
6
- # the official Rust toolchain
7
- FROM clux/muslrust:stable AS chef
8
- USER root
9
- RUN cargo install cargo-chef
10
  WORKDIR /app
11
 
12
- FROM chef AS planner
13
- COPY ./pentaract .
14
- RUN cargo chef prepare --recipe-path recipe.json
15
 
16
- FROM chef AS builder
17
- COPY --from=planner /app/recipe.json recipe.json
18
- # Build dependencies - this is the caching Docker layer!
19
- RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
20
- # Build application
21
- COPY ./pentaract .
22
- RUN cargo build --target x86_64-unknown-linux-musl --release
23
 
24
- ############################################################################################
25
- #### UI
26
- ############################################################################################
 
27
 
28
- FROM node:21-slim AS ui
29
  WORKDIR /app
30
- COPY ./ui .
31
- RUN npm install -g pnpm
32
- RUN pnpm i
33
- ENV VITE_API_BASE /api
34
- RUN pnpm run build
35
-
36
- ############################################################################################
37
- #### RUNNING
38
- ############################################################################################
39
-
40
- # We do not need the Rust toolchain to run the binary!
41
- FROM scratch AS runtime
42
- COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/pentaract /
43
- COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
44
- COPY --from=ui /app/dist /ui
45
- ENTRYPOINT ["/pentaract"]
 
1
+ FROM node:lts AS BUILD_IMAGE
2
+
 
 
 
 
 
 
 
3
  WORKDIR /app
4
 
5
+ COPY . /app
6
+
7
+ RUN npm i --registry http://registry.npmmirror.com && npm run build
8
 
9
+ FROM node:lts-alpine
 
 
 
 
 
 
10
 
11
+ COPY --from=BUILD_IMAGE /app/configs ./configs
12
+ COPY --from=BUILD_IMAGE /app/package.json ./package.json
13
+ COPY --from=BUILD_IMAGE /app/dist ./dist
14
+ COPY --from=BUILD_IMAGE /app/node_modules ./node_modules
15
 
 
16
  WORKDIR /app
17
+
18
+ EXPOSE 8000
19
+
20
+ CMD ["npm", "start"]