-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (24 loc) · 791 Bytes
/
Dockerfile
File metadata and controls
36 lines (24 loc) · 791 Bytes
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
FROM golang:1.25-alpine AS builder
ARG VERSION=dev
ARG GIT_COMMIT=unknown
ARG BUILD_TIME=unknown
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-s -w \
-X github.com/moabdelazem/gitops-sample-app/pkg/version.Version=${VERSION} \
-X github.com/moabdelazem/gitops-sample-app/pkg/version.GitCommit=${GIT_COMMIT} \
-X github.com/moabdelazem/gitops-sample-app/pkg/version.BuildTime=${BUILD_TIME}" \
-o /bin/gitops-app ./cmd/main.go
FROM alpine:3.21
RUN apk --no-cache add ca-certificates \
&& addgroup -S appgroup \
&& adduser -S appuser -G appgroup
WORKDIR /app
COPY --from=builder /bin/gitops-app .
COPY --from=builder /src/web ./web
USER appuser
EXPOSE 8080
ENTRYPOINT ["./gitops-app"]