-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (28 loc) · 1.11 KB
/
Copy pathDockerfile
File metadata and controls
41 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# ---- Build stage ----
FROM golang:1.25-alpine AS builder
RUN apk add --no-cache git ca-certificates tzdata
WORKDIR /src
# Cache dependencies
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
ARG GIT_COMMIT=unknown
ARG BUILD_DATE=unknown
ARG COMPONENT=scheduler
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags "-s -w \
-X github.com/dispatchhub/dispatchhub/internal/shared/infrastructure/version.Version=${VERSION} \
-X github.com/dispatchhub/dispatchhub/internal/shared/infrastructure/version.GitCommit=${GIT_COMMIT} \
-X github.com/dispatchhub/dispatchhub/internal/shared/infrastructure/version.BuildDate=${BUILD_DATE}" \
-o /bin/dispatchhub-${COMPONENT} ./cmd/${COMPONENT}
# ---- Runtime stage ----
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata && \
addgroup -S dispatchhub && adduser -S dispatchhub -G dispatchhub
ARG COMPONENT=scheduler
COPY --from=builder /bin/dispatchhub-${COMPONENT} /usr/local/bin/dispatchhub
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
USER dispatchhub
EXPOSE 8080 9090 9091
ENTRYPOINT ["dispatchhub"]