|
|
@@ -1,24 +1,27 @@
|
|
1
|
1
|
###############################################################################
|
|
2
|
2
|
# BUILD STAGE
|
|
3
|
3
|
|
|
4
|
|
-FROM alpine:3 AS build
|
|
|
4
|
+FROM golang:1.26-alpine AS build
|
|
5
|
5
|
|
|
6
|
6
|
ENV CGO_ENABLED=0
|
|
7
|
|
-ENV GOOS=linux
|
|
8
|
7
|
|
|
9
|
8
|
RUN set -x \
|
|
10
|
9
|
&& apk --no-cache --update add \
|
|
11
|
10
|
bash \
|
|
12
|
11
|
ca-certificates \
|
|
13
|
|
- git \
|
|
14
|
|
- mise
|
|
|
12
|
+ git
|
|
15
|
13
|
|
|
16
|
14
|
COPY . /app
|
|
17
|
15
|
WORKDIR /app
|
|
18
|
16
|
|
|
19
|
17
|
RUN set -x \
|
|
20
|
|
- && mise trust \
|
|
21
|
|
- && mise tasks run static
|
|
|
18
|
+ && version="$(git describe --exact-match HEAD 2>/dev/null || git describe --tags --always)" \
|
|
|
19
|
+ && go build \
|
|
|
20
|
+ -trimpath \
|
|
|
21
|
+ -mod=readonly \
|
|
|
22
|
+ -ldflags="-extldflags '-static' -s -w -X 'main.version=$version'" \
|
|
|
23
|
+ -a \
|
|
|
24
|
+ -tags netgo
|
|
22
|
25
|
|
|
23
|
26
|
|
|
24
|
27
|
###############################################################################
|