diff --git a/Dockerfile b/Dockerfile index 0c6f7d7..ad9b802 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ FROM golang:1.25-alpine AS builder -ARG GIT_COMMIT=unknown +RUN apk add --no-cache git WORKDIR /build +COPY .git ./.git COPY go.mod go.sum ./ RUN go mod download COPY *.go ./ COPY migrations/ ./migrations/ -RUN CGO_ENABLED=0 go build -ldflags "-X main.version=${GIT_COMMIT}" -o dmrmap . +RUN CGO_ENABLED=0 go build -ldflags "-X main.version=$(git rev-parse --short HEAD)" -o dmrmap . FROM alpine:3.19 WORKDIR /app diff --git a/compose.yml b/compose.yml index 60d6e77..a274412 100644 --- a/compose.yml +++ b/compose.yml @@ -10,10 +10,7 @@ services: restart: unless-stopped dmrmap: - build: - context: . - args: - GIT_COMMIT: ${GIT_COMMIT:-unknown} + build: . depends_on: - postgres environment: