Build Docker container FROM scratch
Diff
.dockerignore | 1 +
Dockerfile | 8 +++++---
2 files changed, 5 insertions(+), 4 deletions(-)
@@ -1,1 +1,2 @@
target
Dockerfile
@@ -1,14 +1,14 @@
FROM rust:1-slim-bookworm AS builder
FROM rust:1-alpine AS builder
RUN apk add --no-cache musl-dev
RUN apt update && apt install -y libclang-dev
COPY . /sources
WORKDIR /sources
RUN cargo build --release
RUN chown nobody:nogroup /sources/target/release/bin
FROM gcr.io/distroless/cc-debian12
FROM scratch
COPY --from=builder /sources/target/release/bin /pastebin
COPY --from=builder /etc/passwd /etc/passwd
USER nobody
EXPOSE 8000