From 7a6ed74719ca66575b2d971a3f2c3dfcfe148eeb Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Wed, 3 Feb 2021 09:02:43 -0800 Subject: [PATCH] Swap to pushing images into quay This also adds multi-arch support --- .github/workflows/build.yml | 32 ++++++++++++++++++++++++++++++++ Dockerfile | 7 ++++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..863f72877 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: build + +on: + push: + branches: + - master + tags: + - v* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: azure/docker-login@v1 + with: + login-server: quay.io + username: '${{ secrets.QUAYIO_USERNAME }}' + password: '${{ secrets.QUAYIO_PASSWORD }}' + - name: Set up Docker Buildx + id: buildx + uses: crazy-max/ghaction-docker-buildx@v1 + with: + buildx-version: latest + qemu-version: latest + - name: Available platforms + run: 'echo ${{ steps.buildx.outputs.platforms }}' + - name: Run Buildx + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --push -t quay.io/jacksontj/promxy:${GITHUB_REF##*/} . diff --git a/Dockerfile b/Dockerfile index 4fc322b2c..891815e2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,9 @@ -FROM golang:alpine as builder +FROM --platform=$BUILDPLATFORM golang:alpine as builder + +ARG BUILDPLATFORM +ARG TARGETARCH +ARG TARGETOS +ENV GOARCH=${TARGETARCH} GOOS=${TARGETOS} COPY . /go/src/github.com/jacksontj/promxy RUN cd /go/src/github.com/jacksontj/promxy/cmd/promxy && CGO_ENABLED=0 go build -mod=vendor -tags netgo,builtinassets