-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
31 lines (27 loc) · 1003 Bytes
/
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
FROM clux/muslrust:stable AS chef
USER root
RUN cargo install cargo-chef
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json --bin lurk_chan
# Build application
COPY . .
ARG SQLX_OFFLINE true
RUN cargo build --target x86_64-unknown-linux-musl --release --bin lurk_chan
# We do not need the Rust toolchain to run the binary!
FROM alpine:latest AS runtime
RUN adduser --disabled-password --home /home/container container
USER container
ENV USER=container HOME=/home/container
ENV RUST_BACKTRACE=1
ENV RUST_LOG=info
ENV ENTRYPOINT=lurk_chan
WORKDIR /home/container
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/lurk_chan /bin/lurk_chan
COPY docker_entrypoint.sh /docker_entrypoint.sh
CMD ["/bin/sh","/docker_entrypoint.sh"]