diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-08 13:11:59 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-21 15:20:39 -0600 |
| commit | 2ddcc34ca455973598f5693d64103deea41d8d79 (patch) | |
| tree | 0b3a42aa97bca93c15c67a679c903611e5ab60c1 /Dockerfile | |
| parent | 16c27cd885b9c0d1241dfead3120643f0e8c556c (diff) | |
chore: use minit to start processes from Procfile
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 39 |
1 files changed, 26 insertions, 13 deletions
@@ -1,21 +1,34 @@ # syntax=docker/dockerfile:1 -FROM golang:1.24.3 AS build +# Build stage for getting Envoy binary +FROM envoyproxy/envoy:v1.34-latest AS envoy-binary + +# Build stage for getting dumb-init +FROM debian:bookworm-slim AS dumb-init-builder +RUN apt-get update && apt-get install -y wget && \ + wget -O /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 && \ + chmod +x /usr/bin/dumb-init + +# Build stage for sparkle +FROM golang:1.24-alpine AS build ENV CGO_ENABLED=0 +RUN go install github.com/xlgmokha/minit@latest WORKDIR /app COPY . ./ RUN go build -o /bin/sparkled ./cmd/sparkled/main.go RUN go build -o /bin/authzd ./cmd/authzd/main.go -FROM envoyproxy/envoy:v1.34-latest +# Final stage +FROM gcr.io/distroless/base-debian12:nonroot EXPOSE 8080 9901 10000 10003 -RUN apt-get update && apt-get install -y dumb-init && rm -rf /var/lib/apt/lists/* -WORKDIR /opt/sparkle/ -RUN mkdir -p bin etc public -COPY --from=build /bin/authzd bin/authzd -COPY --from=build /bin/sparkled bin/sparkled -COPY --from=build /app/public public -COPY etc/ etc -COPY bin/*.sh bin/ -RUN chmod +x bin/*.sh -ENTRYPOINT ["/usr/bin/dumb-init", "--"] -CMD ["/opt/sparkle/bin/entrypoint.sh"] +WORKDIR / +COPY --from=envoy-binary /usr/local/bin/envoy /bin/envoy +COPY --from=dumb-init-builder /usr/bin/dumb-init /bin/dumb-init +COPY --from=build /app/Procfile /Procfile +COPY --from=build /app/bin/*.sh /bin/ +COPY --from=build /app/etc/envoy /etc/envoy +COPY --from=build /app/public /public +COPY --from=build /bin/authzd /bin/authzd +COPY --from=build /bin/sparkled /bin/sparkled +COPY --from=build /go/bin/minit /bin/minit +ENTRYPOINT ["/bin/dumb-init", "--"] +CMD ["/bin/minit"] |
