-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·37 lines (30 loc) · 1.13 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM rust:latest as chef
RUN cargo install cargo-chef --version 0.1.66 --root /usr/local/cargo
FROM rust:latest as planner
WORKDIR /usr/src/decensha
COPY --from=chef /usr/local/cargo/bin/cargo-chef /usr/local/cargo/bin/cargo-chef
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && \
echo "fn main() {}" > src/main.rs
RUN cargo chef prepare --recipe-path recipe.json
FROM rust:latest as cacher
WORKDIR /usr/src/decensha
COPY --from=chef /usr/local/cargo/bin/cargo-chef /usr/local/cargo/bin/cargo-chef
COPY --from=planner /usr/src/decensha/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
FROM rust:latest as builder
WORKDIR /usr/src/decensha
COPY --from=cacher /usr/local/cargo /usr/local/cargo
RUN cargo install cargo-watch
COPY src ./src
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release
FROM debian:bookworm-slim
WORKDIR /usr/src/decensha
COPY --from=builder /usr/src/decensha/target/release/decensha /usr/src/decensha/target/release/decensha
RUN apt-get update && \
apt-get install -y openssl libssl-dev && \
rm -rf /var/lib/apt/lists/*
COPY .env ./.env
EXPOSE 7810
CMD ["./target/release/decensha"]