# Stage 1: Build Binary FROM golang:1.22 AS builder WORKDIR /app # Download Dependencies COPY go.mod go.sum ./ RUN --mount=type=cache,target=/root/.cache/go-build \ go mod download # Setup and Build COPY . ./ RUN --mount=type=bind \ CGO_ENABLED=0 GOOS=linux go build -o /snow # Stage 2: Deploy Binary FROM busybox:1.36-glibc as busybox FROM gcr.io/distroless/base AS deploy WORKDIR /app COPY --from=busybox /bin /bin RUN mkdir /app/data # Copy snow binary and configuration files COPY --from=builder /snow /app/snow COPY --from=builder /app/data /app/data # Setup user RUN adduser -D -h /app snow && \ chown -R snow:snow /app USER snow EXPOSE 3000 ENTRYPOINT ["/app/snow"]