-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
24 lines (21 loc) · 773 Bytes
/
Dockerfile
File metadata and controls
24 lines (21 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FROM lukemathwalker/cargo-chef:latest-rust-alpine AS chef
WORKDIR /playmatch
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
RUN apk add --no-cache curl
COPY --from=planner /playmatch/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --locked --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release --locked --bin playmatch
# We do not need the Rust toolchain to run the binary!
FROM alpine:3.20 AS runtime
WORKDIR /playmatch
COPY --from=builder /playmatch/target/release/playmatch /usr/local/bin
RUN adduser -D -H playmatch && chown playmatch:playmatch /playmatch
USER playmatch
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/playmatch"]