feat: enable multi arch building

This commit is contained in:
Tim Brust 2020-06-07 00:53:23 +02:00
parent 7855681c3a
commit 1374ae6183
No known key found for this signature in database
GPG Key ID: 94EA4986FA50F11B
6 changed files with 93 additions and 7 deletions

76
.github/workflows/buildx.yml vendored Normal file
View File

@ -0,0 +1,76 @@
name: buildx
on:
schedule:
- cron: '37 06 * * *'
pull_request:
push:
jobs:
buildx:
runs-on: ubuntu-latest
strategy:
matrix:
docker-file:
- path: 10
tags: 10,dubnium
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
- path: 12
tags: 12,erbium,latest
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=timbru31/node-alpine-git
TAGZ=$(echo ${{ matrix.docker-file.tags }} | tr "," "\n")
VERSION=${TAGZ[0]}
for tag in $TAGZ
do
TAGS="${TAGS} --tag ${DOCKER_IMAGE}:${tag}"
done
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${{ matrix.docker-file.platforms }} \
--build-arg REFRESHED_AT=$(date +%Y-%m-%d) \
${TAGS} --file ./${{ matrix.docker-file.path }}/Dockerfile ./${{ matrix.docker-file.path }}
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v2
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Docker Buildx (build)
run: |
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
- name: Docker Login
if: success() && github.event_name != 'pull_request'
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Docker Buildx (push)
if: success() && github.event_name != 'pull_request'
run: |
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
- name: Docker Check Manifest
if: always() && github.event_name != 'pull_request'
run: |
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
- name: Clear
if: always() && github.event_name != 'pull_request'
run: |
rm -f ${HOME}/.docker/config.json

View File

@ -1,5 +1,5 @@
FROM node:dubnium-alpine@sha256:2c2645270fb31946300e7e0c3f69f01d556f8fc4484d1d3de6cac412e1714ebe
LABEL maintainer "Tim Brust <tim.brust@sinnerschrader.com>"
FROM node:dubnium-alpine
LABEL maintainer "Tim Brust <github@timbrust.de>"
ARG REFRESHED_AT
ENV REFRESHED_AT $REFRESHED_AT

View File

@ -1,5 +1,5 @@
FROM node:erbium-alpine@sha256:7d7ad9b819f7064e215aa68a925f22b6a4417598bf017132201f9f1c6f2f0f62
LABEL maintainer "Tim Brust <tim.brust@sinnerschrader.com>"
FROM node:erbium-alpine
LABEL maintainer "Tim Brust <github@timbrust.de>"
ARG REFRESHED_AT
ENV REFRESHED_AT $REFRESHED_AT

View File

@ -14,6 +14,17 @@ A minimal Dockerfile based on Node.js 10 LTS (Dubnium) or Node.js 12 LTS (Erbium
- Git
- ssh
## Available platforms
These Dockerfiles leverage the new `buildx` functionality and offer the following platforms:
- linux/amd64
- linux/arm64
- linux/arm/v7
- linux/arm/v6
- linux/ppc64le
- linux/s390x
- linux/386
---
Built by (c) Tim Brust and contributors. Released under the MIT license.

View File

@ -1,2 +0,0 @@
#!/bin/bash
docker build --build-arg REFRESHED_AT="$(date +%Y-%m-%d)" -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .

View File

@ -1,7 +1,8 @@
{
"extends": [
"config:base",
":automergeDigest",
":disableRenovate",
":pinDigestsDisabled",
":automergePatch",
":automergeMinor",
":automergePr",