1
0
Files
minecraft_schematics_web/Dockerfile
2026-01-14 14:55:57 +00:00

30 lines
1022 B
Docker

# Global build arguments
ARG RUST_VERSION=1.92.0
# -----------
# Build stage
# -----------
FROM rust:${RUST_VERSION}-slim-bullseye AS build
# All build operations happen here
WORKDIR /app
# Build the application using Docker BuildKit mounts:
# - bind mounts for source files (not baked into the image)
# - cache mounts for faster incremental builds
RUN --mount=type=bind,source=src,target=src,readonly \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml,readonly \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock,readonly \
--mount=type=cache,target=/app/target \
--mount=type=cache,target=/usr/local/cargo/registry \
cargo build --release --locked && \
install -m 0755 target/release/minecraft_schematics_web /bin/minecraft_schematics_web
# -------------
# Runtime stage
# -------------
FROM debian:bullseye-slim AS final
# Copy only the compiled binary from the build stage
COPY --from=build /bin/minecraft_schematics_web /bin/
# Run the binary
CMD ["/bin/minecraft_schematics_web"]