update Dockerfile

pull/616/head
ginuerzh 2024-10-11 13:10:15 +08:00
parent a7037a27bf
commit 48b0a690c5
2 changed files with 12 additions and 15 deletions

View File

@ -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

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
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