# Use the official Golang image to create a build artifact.
FROM golang:1.23 as builder
# Set the Current Working Directory inside the container
WORKDIR /go/src/app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 go build -o /go/bin/app
# Install pg_dump by installing postgresql-client
RUN apt-get update && apt-get install -y --no-install-recommends postgresql-client && \
rm -rf /var/lib/apt/lists/*
# Start a new stage from scratch
FROM gcr.io/distroless/static-debian11
# Copy the Pre-built binary file from the previous stage
COPY --from=builder /go/bin/app /
COPY --from=builder /go/src/app/local_manifest.yaml /
# Copy the pg_dump binary and necessary libraries from the first stage
COPY --from=builder /usr/bin/pg_dump /
COPY --from=builder /lib/x86_64-linux-gnu /lib/x86_64-linux-gnu
# Debug
COPY --from=builder /bin/sh /bin/sh
# Expose port 8080 to the outside world
EXPOSE 8080
# Command to run the executable
ENTRYPOINT ["/app"]
None of the things are there. Like /bin/sh or pg_dump none of them are there. app IS there. So I don't really understand what's going on here?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Console Output
If applicable, add information from your container run
Additional context
Add any other context about the problem here.
Describe the bug Trying to build this dockerfile:
None of the things are there. Like
/bin/sh
orpg_dump
none of them are there.app
IS there. So I don't really understand what's going on here?To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Console Output If applicable, add information from your container run
Additional context Add any other context about the problem here.