# syntax=docker/dockerfile:1.6 FROM golang:1.25-alpine AS build # git is needed at build time to read the commit SHA. Dokploy clones the # source with --depth 1 so .git/ is present inside the build context after # the COPY below — `git rev-parse` resolves the actual commit being built. # No build-arg orchestration needed; any environment that ships .git/ # alongside source gets the right value. RUN apk add --no-cache git WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . RUN GIT_COMMIT="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)" && \ CGO_ENABLED=0 go build -trimpath \ -ldflags="-s -w -X main.gitCommit=${GIT_COMMIT}" \ -o /out/projax ./cmd/projax FROM gcr.io/distroless/static-debian12:nonroot COPY --from=build /out/projax /projax ENV PROJAX_LISTEN_ADDR=:8080 EXPOSE 8080 USER nonroot:nonroot ENTRYPOINT ["/projax"]