forked from ferrumc-rs/ferrumc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (29 loc) · 893 Bytes
/
Dockerfile
File metadata and controls
34 lines (29 loc) · 893 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
25
26
27
28
29
30
31
32
33
34
FROM rust:alpine3.20 AS chef
RUN apk add --no-cache musl-dev gcc openssl-dev openssl-libs-static pkgconfig
# Install nightly toolchain
RUN rustup toolchain install nightly && \
rustup default nightly
RUN cargo install cargo-chef
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# Build dependencies
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# Build app
COPY . .
RUN cargo build --release
RUN strip target/release/ferrumc
# Minimal runtime
FROM alpine:3.20
WORKDIR /app
RUN addgroup -S ferrumc && adduser -S ferrumc -G ferrumc
COPY --from=builder /app/target/release/ferrumc /app/
RUN chown -R ferrumc:ferrumc /app
USER ferrumc
EXPOSE 25565
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s \
CMD nc -z localhost 25565 || exit 1
CMD ["./ferrumc"]