add multi-arch support and CI workflow

pull/1/head
Arkav 2 weeks ago
parent 0c23dbd12b
commit 4ccec8ce22

@ -0,0 +1,45 @@
name: Build docker containers
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
packages: write
env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build per-arch images
- name: Build amd64 image
run: |
docker build -t ${IMAGE_NAME}:${VERSION}-amd64 -f Dockerfile --build-arg ARCH=amd64 .
- name: Build arm64 image
run: |
docker build -t ${IMAGE_NAME}:${VERSION}-arm64 -f Dockerfile --build-arg ARCH=arm64 .
- name: Push per-arch images
run: |
docker push ${IMAGE_NAME}:${VERSION}-amd64
docker push ${IMAGE_NAME}:${VERSION}-arm64
# Create multi-arch manifest and push
- name: Push multi-arch manifest
run: |
docker manifest create ${IMAGE_NAME}:${VERSION} \
--amend ${IMAGE_NAME}:${VERSION}-amd64 \
--amend ${IMAGE_NAME}:${VERSION}-arm64
docker manifest push ${IMAGE_NAME}:${VERSION}
- name: Tag as latest
run: |
docker manifest create ${IMAGE_NAME}:latest \
--amend ${IMAGE_NAME}:${VERSION}-amd64 \
--amend ${IMAGE_NAME}:${VERSION}-arm64
docker manifest push ${IMAGE_NAME}:latest

@ -1,11 +1,10 @@
FROM golang:1.24-alpine
WORKDIR /app
FROM golang:1.24-alpine AS build
ARG ARCH=amd64
WORKDIR /build
COPY main.go .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -o seadex-proxy main.go
RUN go build -o app main.go
FROM scratch
COPY --from=build /build/seadex-proxy /seadex-proxy
ENTRYPOINT ["/seadex-proxy"]
EXPOSE 6778
CMD ["./app"]
Loading…
Cancel
Save