-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (31 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
40 lines (31 loc) · 1.1 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
# =========================================
# Build stage
# =========================================
FROM --platform=$BUILDPLATFORM golang:1.24-alpine3.21 as build
ARG TARGETOS
ARG TARGETARCH
ARG BUILD_DATE
ARG GIT_COMMIT
ARG GIT_VERSION
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download && go mod verify && go mod tidy
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 \
GOOS=$TARGETOS \
GOARCH=$TARGETARCH \
go build \
-ldflags="-s -w \
-X github.com/brpaz/github-notifications-cleaner/cmd/version.BuildDate=${BUILD_DATE} \
-X github.com/brpaz/github-notifications-cleaner/cmd/version.Version=${GIT_VERSION} \
-X github.com/brpaz/github-notifications-cleaner/cmd/version.GitCommit.=${GIT_COMMIT} \
-extldflags '-static'" -a \
-o /out/github-notifications-cleaner ./main.go
# ====================================
# Production stage
# ====================================
FROM alpine:3.21
COPY --from=build /out/github-notifications-cleaner /bin
ENTRYPOINT ["/bin/github-notifications-cleaner"]