forked from szabodanika/microbin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (25 loc) · 1.04 KB
/
Copy pathDockerfile
File metadata and controls
39 lines (25 loc) · 1.04 KB
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
35
36
37
38
39
FROM rust:1-bookworm AS build
WORKDIR /app
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
apt-get -y install --no-install-recommends ca-certificates tzdata && \
rm -rf /var/lib/apt/lists/*
COPY . .
RUN CARGO_NET_GIT_FETCH_WITH_CLI=true cargo build --release && \
mkdir -p /app/microbin_data
# Use debian-slim as the base image for runtime to include standard libraries (libbz2, liblzma, etc.)
FROM debian:bookworm-slim
WORKDIR /app
# copy time zone info from build stage
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
# copy CA certificates from build stage
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# copy built executable
COPY --from=build /app/target/release/microbin /usr/bin/microbin
# copy data directory skeleton with nonroot ownership
COPY --from=build --chown=65532:65532 /app/microbin_data /app/microbin_data
USER 65532:65532
VOLUME ["/app/microbin_data"]
# Expose webport used for the webserver to the docker runtime
EXPOSE 8080
ENTRYPOINT ["/usr/bin/microbin"]