Added docker building.

This commit is contained in:
2023-02-21 19:56:36 +00:00
parent f5b43573c8
commit b6ab9c8888
31 changed files with 1476 additions and 75 deletions

View File

@ -4,6 +4,7 @@ WORKDIR /app
COPY Cargo.toml Cargo.lock askama.toml ./
COPY src ./src
COPY static ./static
# Build binary in release mode.
RUN cargo build --release --all-features
FROM debian:bullseye-20230109-slim as base
@ -16,12 +17,16 @@ RUN apt-get update \
COPY static ./static
# Copy built binary to a new image.
COPY --from=builder /app/target/release/s3bot /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/s3bot"]
FROM base as rootless
# Create a user and make the image rootless. So no one
# can escalate privileges even if they have access to
# container.
RUN useradd --create-home -u 1000 --user-group s3bot
WORKDIR /home/s3bot
RUN mv /static ./static