Skip to content

Commit 115feee

Browse files
committed
fix: update base images and add platform arguments in Dockerfiles
1 parent c2ae429 commit 115feee

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

docker/alpine/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
FROM snowdreamtech/golang:1.23.5-alpine3.21 AS builder
1+
FROM --platform=$BUILDPLATFORM snowdreamtech/golang:1.23.7-alpine3.21 AS builder
2+
3+
ARG TARGETOS
4+
ARG TARGETARCH
25

36
# Switch to the user
47
USER root
@@ -38,13 +41,13 @@ RUN go mod tidy \
3841
&& LDGOFLAGS="${LDGOFLAGS} -X '${CmdPath}.GitTag=${GitTag}'" \
3942
&& LDGOFLAGS="${LDGOFLAGS} -X '${CmdPath}.COPYRIGHT=${COPYRIGHT}'" \
4043
&& LDGOFLAGS="${LDGOFLAGS} -X '${CmdPath}.LICENSE=${LICENSE}'" \
41-
&& go build -trimpath -ldflags "${LDGOFLAGS} -s -w" -v -o gserver
44+
&& CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -ldflags "${LDGOFLAGS} -s -w" -v -o gserver
4245

4346

4447

4548

4649

47-
FROM snowdreamtech/alpine:3.21.0
50+
FROM snowdreamtech/alpine:3.21.3
4851

4952
# OCI annotations to image
5053
LABEL org.opencontainers.image.authors="Snowdream Tech" \

docker/debian/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
FROM snowdreamtech/golang:1.23.5-bookworm AS builder
1+
FROM --platform=$BUILDPLATFORM snowdreamtech/golang:1.23.5-bookworm AS builder
2+
3+
ARG TARGETOS
4+
ARG TARGETARCH
25

36
# Switch to the user
47
USER root
@@ -45,14 +48,14 @@ RUN go mod tidy \
4548
&& LDGOFLAGS="${LDGOFLAGS} -X '${CmdPath}.GitTag=${GitTag}'" \
4649
&& LDGOFLAGS="${LDGOFLAGS} -X '${CmdPath}.COPYRIGHT=${COPYRIGHT}'" \
4750
&& LDGOFLAGS="${LDGOFLAGS} -X '${CmdPath}.LICENSE=${LICENSE}'" \
48-
&& go build -trimpath -ldflags "${LDGOFLAGS} -s -w" -v -o gserver
51+
&& CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -ldflags "${LDGOFLAGS} -s -w" -v -o gserver
4952

5053

5154

5255

5356

5457

55-
FROM snowdreamtech/debian:12.8.0
58+
FROM snowdreamtech/debian:12.10.0
5659

5760
# OCI annotations to image
5861
LABEL org.opencontainers.image.authors="Snowdream Tech" \

0 commit comments

Comments
 (0)