diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml index 5fd262f..4ed0cd0 100644 --- a/.github/workflows/release-artifacts.yml +++ b/.github/workflows/release-artifacts.yml @@ -7,6 +7,7 @@ on: permissions: contents: write + packages: write jobs: build-and-upload: @@ -81,3 +82,35 @@ jobs: dist/*.tar.gz dist/*.zip dist/sha256sums.txt + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value=${{ github.event.release.tag_name }} + type=raw,value=latest + + - name: Build and Push Docker Image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 3199cfb..a67dfd1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,10 +8,12 @@ RUN npm run build FROM golang:1.24 AS go-builder WORKDIR /app +ARG TARGETOS=linux +ARG TARGETARCH=amd64 COPY go.mod go.sum* ./ RUN go mod download COPY . . -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /out/ds2api ./cmd/ds2api +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /out/ds2api ./cmd/ds2api FROM debian:bookworm-slim WORKDIR /app