File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,20 @@ jobs:
1010 build :
1111 runs-on : ubuntu-latest
1212
13+ strategy :
14+ matrix :
15+ goos : [linux]
16+ goarch : [amd64, arm64]
1317 steps :
1418 - uses : actions/checkout@v3
1519 - name : Docker Login
1620 env :
1721 DOCKER_USER : ${{ secrets.DOCKER_USER }}
1822 DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
23+ GOOS : ${{ matrix.goos }}
24+ GOARCH : ${{ matrix.goarch }}
25+ CGO_ENABLED : 0
26+ GO111MODULE : on
1927 run : |
2028 docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
2129 - name : Build the Docker image
Original file line number Diff line number Diff line change 11FROM golang:1.20 AS builder
2-
3- ENV GO111MODULE=on \
4- CGO_ENABLED=0 \
5- GOOS=linux \
6- GOARCH=amd64
7-
2+ RUN apk --no-cache add tzdata
83WORKDIR /build
94COPY . .
105RUN go mod tidy && go build -ldflags "-s -w" -o main
116
127
13- FROM alpine
14-
15- RUN apk --update --no-cache add tzdata ca-certificates \
16- && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
17- && mkdir -p conf && touch conf/whitelist
8+ FROM scratch
9+ COPY --from=builder /user/share/zoneinfo /user/share/zoneinfo
10+ COPY --from=builder /build/conf conf
1811COPY --from=builder /build/main /
12+ ENV TZ=Asia/Shanghai
1913
2014ENTRYPOINT ["/main" ]
You can’t perform that action at this time.
0 commit comments