feature(docker) add support of multi-arch builds (#291)

This commit is contained in:
Timo Knapp 2021-01-19 12:05:39 +01:00 committed by coderaiser
parent 11cc63adcd
commit 99b93e760a
8 changed files with 104 additions and 255 deletions

67
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,67 @@
name: Docker CI
on:
push:
tags:
- '*'
jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: NPM Install
run: |
npm install
- name: NPM Lint
run: |
npm run lint
- name: NPM Build
id: npm-build
run: |
npm run build
echo "::set-output name=version::$(grep '"version":' package.json -m1 | cut -d\" -f4)"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Docker Username and Password have to be set as secrets in GitHub repo.
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push base-image
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
coderaiser/cloudcmd:latest
coderaiser/cloudcmd:${{ steps.npm-build.outputs.version }}
- name: Build and push alpine-image
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile.alpine
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
coderaiser/cloudcmd-alpine:latest
coderaiser/cloudcmd-alpine:${{ steps.npm-build.outputs.version }}

View file

@ -4,34 +4,32 @@ on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: install
run: |
npm install
- name: lint
run: |
npm run lint
- name: build
run: |
npm run build
npm test
- name: test
run: |
npm test
- uses: actions/checkout@master
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: coverage
run: |
npm run coverage
- name: install
run: |
npm install
- name: lint
run: |
npm run lint
- name: build
run: |
npm run build
npm test
- name: test
run: |
npm test
- name: coverage
run: |
npm run coverage