add cross-compile

This commit is contained in:
Noah 2024-12-22 03:52:10 +01:00
parent 453f03d832
commit 96db61831c
2 changed files with 8 additions and 8 deletions

View file

@ -12,9 +12,6 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@ -29,7 +26,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7
push: true
tags: |
ghcr.io/${{ github.repository }}:master

View file

@ -1,12 +1,15 @@
FROM golang:alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.23.4-alpine AS builder
WORKDIR /steamsalty
RUN apk update && apk add --no-cache ca-certificates
COPY . .
COPY go.mod go.sum ./
RUN go mod download
RUN go build -o /app/steamsalty
COPY . .
ARG TARGETOS TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /app/steamsalty
@ -18,4 +21,4 @@ COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates
COPY --from=builder /app/steamsalty /app/steamsalty
ENTRYPOINT ["/app/steamsalty"]
ENTRYPOINT ["/app/steamsalty"]