Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch porch-server to use distroless image #4047

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions porch/build/Dockerfile.porch
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ RUN echo "Downloading porch modules ..." \
RUN echo "Downloading api modules ..." \
&& cd porch/api && go mod download

ENV CGO_ENABLED=0
# Prebuild some library dependencies to warm the cache
RUN cd porch; go build -v \
google.golang.org/grpc \
Expand All @@ -53,15 +54,7 @@ COPY porch/func porch/func

RUN cd porch; go build -v -o /porch ./cmd/porch

FROM debian:bookworm-slim
RUN apt update && apt install -y ca-certificates && apt install -y git && rm -rf /var/lib/apt && rm -rf /var/cache/apt

RUN useradd -s /bin/bash -d /home/porch/ -m -u 1999 porch
WORKDIR /home/porch

COPY --from=builder /porch /home/porch/porch
RUN chown porch:porch /home/porch/porch; chmod +x /home/porch/porch

USER porch

ENTRYPOINT ["/home/porch/porch"]
FROM gcr.io/distroless/static:nonroot
COPY --from=builder --chown=nonroot:nonroot /porch /home/nonroot/porch
USER nonroot:nonroot
ENTRYPOINT ["/home/nonroot/porch"]
Loading