docker: include Alpine base tools, tini

Including tini fixes forwarding signals to MinedMap, allowing to
interrupt it using Ctrl-C. The base tools may be used to add a wrapper
script to configure MinedMap with environment variables.

As the Alpine base is included now, we can switch from the rust:alpine
image to alpine:latest, resulting in MinedMap to be linked dynamically.
This commit is contained in:
Matthias Schiffer 2025-02-14 16:49:42 +01:00
parent cb0aa235db
commit 3b5ce82873
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
2 changed files with 13 additions and 8 deletions

4
.dockerignore Normal file
View file

@ -0,0 +1,4 @@
*
!/Cargo.*
!/src
!/crates

View file

@ -1,14 +1,15 @@
FROM docker.io/library/rust:alpine AS BUILDER FROM docker.io/library/alpine:latest AS BUILDER
WORKDIR /build WORKDIR /build
RUN apk update && apk add cmake build-base RUN apk add --no-cache build-base cmake cargo
COPY src /build/src COPY . .
COPY crates /build/crates
COPY Cargo.toml Cargo.lock /build
RUN cargo build -r RUN cargo build -r
RUN strip target/release/minedmap
FROM scratch AS RUNNER FROM docker.io/library/alpine:latest
COPY --from=BUILDER /build/target/release/minedmap /minedmap RUN apk add --no-cache libgcc tini
ENTRYPOINT [ "/minedmap" ]
COPY --from=BUILDER /build/target/release/minedmap /bin/minedmap
ENTRYPOINT [ "/sbin/tini", "--", "/bin/minedmap" ]