🏡 index : ~doyle/bin.git

author Jordan Doyle <jordan@doyle.la> 2023-11-27 20:06:32.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2023-11-27 20:06:32.0 +00:00:00
commit
c2678219d8e8fcd826763b6a0485f53171bf6da2 [patch]
tree
56dd1976d24a64479e1f228d105b45792a670533
parent
7c0bb9f220e36c2a3e9c8968b71377977032d595
download
c2678219d8e8fcd826763b6a0485f53171bf6da2.tar.gz

Build Docker container FROM scratch



Diff

 .dockerignore | 1 +
 Dockerfile    | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.dockerignore b/.dockerignore
index eb5a316..a099dca 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1 +1,2 @@
target
Dockerfile
diff --git a/Dockerfile b/Dockerfile
index 0a9e759..c71b0c1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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