Fixed CI/CD to build arm architecture image

This commit is contained in:
Vincent Composieux 2020-05-04 20:50:12 +02:00
parent a124a6be35
commit 548b6edc3e
No known key found for this signature in database
GPG Key ID: 7306974ABA6382AC
2 changed files with 13 additions and 3 deletions

View File

@ -31,7 +31,16 @@ jobs:
repository: ekofr/pihole-exporter repository: ekofr/pihole-exporter
tag_with_sha: true tag_with_sha: true
tags: amd64 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) - name: Build and Push Docker Image (Linux - ARM64)
uses: docker/build-push-action@v1 uses: docker/build-push-action@v1
with: with:
@ -40,4 +49,4 @@ jobs:
repository: ekofr/pihole-exporter repository: ekofr/pihole-exporter
tag_with_sha: true tag_with_sha: true
tags: arm64 tags: arm64
build_args: OS=linux,ARCH=arm64 build_args: OS=linux,ARCH=arm64,IMAGE=arm64v8/alpine:3.11

View File

@ -2,6 +2,7 @@ FROM golang:alpine as builder
ARG OS=linux ARG OS=linux
ARG ARCH=amd64 ARG ARCH=amd64
ARG IMAGE=scratch
WORKDIR /go/src/github.com/eko/pihole-exporter WORKDIR /go/src/github.com/eko/pihole-exporter
COPY . . 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 CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH go build -ldflags '-s -w' -o binary ./
RUN upx -f --brute binary RUN upx -f --brute binary
FROM scratch FROM $IMAGE
LABEL name="pihole-exporter" LABEL name="pihole-exporter"