diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 7d2782d..4d00320 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -21,6 +21,10 @@ jobs: with: go-version-file: go.mod + - uses: docker/setup-qemu-action@v3 + + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v4 with: registry: ghcr.io diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2c71690..f55c4d2 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -34,7 +34,12 @@ changelog: - "^docs:" - "^test:" -dockers: - - image_templates: - - "ghcr.io/laenzlinger/setlist:latest" - - "ghcr.io/laenzlinger/setlist:{{ .Tag }}" +dockers_v2: + - images: + - "ghcr.io/laenzlinger/setlist" + tags: + - "{{ .Tag }}" + - "latest" + platforms: + - linux/amd64 + - linux/arm64 diff --git a/Dockerfile b/Dockerfile index b2e4a32..0784688 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM docker.io/chromedp/headless-shell:latest +ARG TARGETPLATFORM + RUN apt-get update \ && apt-get install -y libreoffice-writer \ && rm -rf /var/lib/apt/lists/* @@ -14,6 +16,6 @@ RUN mkdir /repertoire WORKDIR /repertoire -COPY setlist /setlist +COPY ${TARGETPLATFORM}/setlist /setlist ENTRYPOINT [ "/setlist" ] diff --git a/Makefile b/Makefile index 770a12e..79f45b7 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,14 @@ clean: ## clean all output files rm -rf dist go clean -testcache -docker-build: build ## build the ocker container - docker build -t $(DOCKER_IMAGE):latest . +docker-build: build ## build the docker image (native arch) + @mkdir -p linux/$(shell go env GOARCH) + @cp setlist linux/$(shell go env GOARCH)/setlist + docker build --build-arg TARGETPLATFORM=linux/$(shell go env GOARCH) -t $(DOCKER_IMAGE):latest . + @rm -rf linux + +docker-build-multiarch: ## build multi-arch docker image via goreleaser snapshot + goreleaser release --snapshot --clean help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'