1
0

Add Dockerfile

This commit is contained in:
2024-02-03 00:40:27 +00:00
parent a8076f726f
commit 54c0b7747a

41
Dockerfile Normal file
View File

@@ -0,0 +1,41 @@
ARG RUST_VERSION=1.75.0
ARG APP_NAME=minecraft_schematics_web
FROM rust:${RUST_VERSION}-slim-bullseye AS build
# RUN apt-get update && apt-get install -y pkg-config libssl-dev
ARG APP_NAME
WORKDIR /app
RUN --mount=type=bind,source=src,target=src \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
--mount=type=cache,target=/app/target \
--mount=type=cache,target=/usr/local/cargo/registry \
<<EOF
set -e
cargo build --locked --release
cp ./target/release/$APP_NAME /bin/server
EOF
FROM debian:bullseye-slim AS final
# RUN apt-get update && apt-get install -y ca-certificates
ENV PUID=1000 PGID=1000
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${PUID}" \
appuser
USER appuser
COPY --from=build /bin/server /bin/
CMD ["/bin/server"]