From 548b6edc3e47444ad74b1938be300cea5ab46335 Mon Sep 17 00:00:00 2001 From: Vincent Composieux Date: Mon, 4 May 2020 20:50:12 +0200 Subject: [PATCH] Fixed CI/CD to build arm architecture image --- .github/workflows/main.yml | 13 +++++++++++-- Dockerfile | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a91480..fb02d18 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,16 @@ jobs: repository: ekofr/pihole-exporter tag_with_sha: true tags: amd64 - build_args: OS=linux,ARCH=amd64 + build_args: OS=linux,ARCH=amd64,IMAGE=scratch + - name: Build and Push Docker Image (Linux - ARM32) + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: ekofr/pihole-exporter + tag_with_sha: true + tags: arm32 + build_args: OS=linux,ARCH=arm32,IMAGE=arm32v7/alpine:3.11 - name: Build and Push Docker Image (Linux - ARM64) uses: docker/build-push-action@v1 with: @@ -40,4 +49,4 @@ jobs: repository: ekofr/pihole-exporter tag_with_sha: true tags: arm64 - build_args: OS=linux,ARCH=arm64 + build_args: OS=linux,ARCH=arm64,IMAGE=arm64v8/alpine:3.11 diff --git a/Dockerfile b/Dockerfile index 6d644e9..901cfeb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM golang:alpine as builder ARG OS=linux ARG ARCH=amd64 +ARG IMAGE=scratch WORKDIR /go/src/github.com/eko/pihole-exporter COPY . . @@ -13,7 +14,7 @@ RUN GO111MODULE=on go mod vendor RUN CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH go build -ldflags '-s -w' -o binary ./ RUN upx -f --brute binary -FROM scratch +FROM $IMAGE LABEL name="pihole-exporter"