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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -37
Dockerfile CHANGED
@@ -1,42 +1,45 @@
1
- FROM node:alpine
2
- LABEL maintainer="whyour"
 
3
 
4
- ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
5
- LANG=zh_CN.UTF-8 \
6
- SHELL=/bin/bash \
7
- PS1="\u@\h:\w \$ " \
8
- LANG=zh_CN.UTF-8 \
9
- LANGUAGE=zh_CN.UTF-8 \
10
- LC_ALL=zh_CN.UTF-8 \
11
- TZ=Asia/Shanghai
12
 
13
- RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
14
- && apk update -f \
15
- && apk upgrade \
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
- RUN git clone https://ghproxy.com/https://github.com/whyour/qinglong /ql \
29
- && cd /ql \
30
- && git checkout --quiet master \
31
- && cp docker/docker-entrypoint.sh / \
32
- && chmod 777 /docker-entrypoint.sh \
33
- && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
34
- && echo "Asia/Shanghai" > /etc/timezone \
35
- && cd /ql/scripts/ \
36
- && npm install \
37
- && npm install -g pm2 \
38
- && pm2 start /ql/build/app.js
39
 
40
- WORKDIR /ql
 
 
41
 
42
- ENTRYPOINT ["/docker-entrypoint.sh"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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"]