diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml index 85990e6..523327e 100644 --- a/.github/workflows/buildx.yml +++ b/.github/workflows/buildx.yml @@ -59,13 +59,13 @@ jobs: - name: Login to DockerHub if: github.event_name != 'pull_request' - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Buildx and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: platforms: ${{ steps.prepare.outputs.docker_platforms }} push: true diff --git a/Dockerfile b/Dockerfile index e658403..3a434c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,24 @@ +FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.5.0 AS xx + FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS builder -ARG TARGETOS -ARG TARGETARCH +COPY --from=xx / / -# RUN apk add --no-cache musl-dev git gcc +ARG TARGETPLATFORM + +RUN xx-info env ENV CGO_ENABLED=0 -RUN go env +ENV XX_VERIFY_STATIC=1 WORKDIR /app -# Cache the download before continuing -COPY go.mod go.mod -COPY go.sum go.sum -RUN go mod download - COPY . . -WORKDIR /app/cmd/gost - -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ - go build +RUN cd cmd/gost && \ + xx-go build && \ + xx-verify gost FROM alpine:3.20