Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Build multiarch docker images (#604)
Browse files Browse the repository at this point in the history
* Build multiarch docker images

* Build tags too
  • Loading branch information
der-eismann authored Mar 1, 2021
1 parent 3b710fe commit f9f4157
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 8 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,55 @@ jobs:
- name: Build Project
run: |
make
docker_build:
runs-on: ubuntu-20.04
name: Docker Build

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Generate image tags
shell: bash
run: |
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
echo "##[set-output name=tags;]quay.io/rebuy/aws-nuke:${GITHUB_HEAD_REF},docker.io/rebuy/aws-nuke:${GITHUB_HEAD_REF}"
else
echo "##[set-output name=tags;]quay.io/rebuy/aws-nuke:main,docker.io/rebuy/aws-nuke:main,\
quay.io/rebuy/aws-nuke:latest,docker.io/rebuy/aws-nuke:latest"
fi
id: generate_tags

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
platforms: arm64,arm/v7

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.generate_tags.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
46 changes: 46 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,49 @@ jobs:
tag: ${{ github.ref }}
overwrite: true
file_glob: true

docker_build:
runs-on: ubuntu-20.04
name: Docker Build

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Generate image tags
shell: bash
run: echo "##[set-output name=tags;]quay.io/rebuy/aws-nuke:${GITHUB_REF#refs/tags/},docker.io/rebuy/aws-nuke:${GITHUB_REF#refs/tags/}"
id: generate_tags

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
platforms: arm64,arm/v7

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.generate_tags.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
8 changes: 0 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Source: https://github.com/rebuy-de/golang-template

FROM golang:1.16-alpine as builder

RUN apk add --no-cache git make curl openssl
Expand All @@ -8,11 +6,6 @@ RUN apk add --no-cache git make curl openssl
ENV GOPATH=/go PATH=/go/bin:$PATH CGO_ENABLED=0 GO111MODULE=on
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin

ENV GO111MODULE on
# Install Go Tools
RUN go get -u golang.org/x/lint/golint


WORKDIR /src

COPY go.mod .
Expand All @@ -22,7 +15,6 @@ RUN go mod download
COPY . .

RUN set -x \
&& make test \
&& make build \
&& cp /src/dist/aws-nuke /usr/local/bin/

Expand Down

0 comments on commit f9f4157

Please sign in to comment.