FROM golang:1.25.5-alpine3.23@sha256:6cc2338c038bc20f96ab32848da2b5c0641bb9bb5363f2c33e9b7c8838f9a208 AS build WORKDIR /app # Retrieve dependencies. Making this a separated step makes # Docker be able to reuse cached dependencies COPY go.* ./ RUN go mod download # Copy local code COPY . ./ # Build the binary RUN go build -v -o depgraph # Use standard alpine to run the application to # have a lean production container FROM debian:trixie-slim@sha256:4bcb9db66237237d03b55b969271728dd3d955eaaa254b9db8a3db94550b1885 RUN set -x && apt-get update && DEBIAN_FRONTEND=nointeractive apt-get install -y \ ca-certificates && \ rm -rf /var/lib/apt/lists/* # Copy binary from build step to production image COPY --from=build /app/depgraph /app/depgraph # Run the application CMD ["/app/depgraph"]