Update Dockerfile
Browse files- Dockerfile +40 -37
Dockerfile
CHANGED
@@ -1,42 +1,45 @@
|
|
1 |
-
|
2 |
-
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
LC_ALL=zh_CN.UTF-8 \
|
11 |
-
TZ=Asia/Shanghai
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
&& apk --no-cache add -f bash \
|
17 |
-
coreutils \
|
18 |
-
moreutils \
|
19 |
-
git \
|
20 |
-
wget \
|
21 |
-
curl \
|
22 |
-
nano \
|
23 |
-
tzdata \
|
24 |
-
perl \
|
25 |
-
openssl \
|
26 |
-
&& rm -rf /var/cache/apk/*
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
&& cd /ql/scripts/ \
|
36 |
-
&& npm install \
|
37 |
-
&& npm install -g pm2 \
|
38 |
-
&& pm2 start /ql/build/app.js
|
39 |
|
40 |
-
|
|
|
|
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"]
|