mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-07-30 06:21:39 +00:00
Baking SOURCE_COMMIT as a Docker build arg never worked: Coolify exposes it as a runtime env var, not a build arg, so gitSHA was always empty and the owner DM was skipped. Read SOURCE_COMMIT from the container env at startup (falling back to the ldflags-baked gitSHA for local builds), forward it via the compose environment, and drop the dead build-arg baking.
22 lines
571 B
Docker
22 lines
571 B
Docker
FROM golang:1.25-alpine AS builder
|
|
WORKDIR /src
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
# The deploy-notify commit SHA comes from the SOURCE_COMMIT runtime env that
|
|
# Coolify injects into the container (see docker-compose.yml), not from a build
|
|
# arg — Coolify does not pass build args here. The binary is built plain.
|
|
RUN CGO_ENABLED=0 GOOS=linux go build \
|
|
-ldflags="-s -w" \
|
|
-o /out/server \
|
|
./cmd/server
|
|
|
|
FROM gcr.io/distroless/static:nonroot
|
|
COPY --from=builder /out/server /server
|
|
USER nonroot:nonroot
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/server"]
|