Skip to content

Commit

Permalink
Build Docker container FROM scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
w4 committed Nov 27, 2023
1 parent 7c0bb9f commit c267821
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target
Dockerfile
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM rust:1-slim-bookworm AS builder

RUN apt update && apt install -y libclang-dev
FROM rust:1-alpine AS builder
RUN apk add --no-cache musl-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
Expand Down

0 comments on commit c267821

Please sign in to comment.