update Dockerfile

This commit is contained in:
ginuerzh
2024-10-11 13:10:15 +08:00
parent a7037a27bf
commit 48b0a690c5
2 changed files with 12 additions and 15 deletions
+2 -2
View File
@@ -59,13 +59,13 @@ jobs:
- name: Login to DockerHub - name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Buildx and push - name: Buildx and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v6
with: with:
platforms: ${{ steps.prepare.outputs.docker_platforms }} platforms: ${{ steps.prepare.outputs.docker_platforms }}
push: true push: true
+10 -13
View File
@@ -1,27 +1,24 @@
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.5.0 AS xx
FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS builder FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS builder
ARG TARGETOS COPY --from=xx / /
ARG TARGETARCH
# RUN apk add --no-cache musl-dev git gcc ARG TARGETPLATFORM
RUN xx-info env
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0
RUN go env ENV XX_VERIFY_STATIC=1
WORKDIR /app WORKDIR /app
# Cache the download before continuing
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY . . COPY . .
WORKDIR /app/cmd/gost RUN cd cmd/gost && \
xx-go build && \
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ xx-verify gost
go build
FROM alpine:3.20 FROM alpine:3.20