0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

build: publish docker multi-arch image with github actions (#2031)

powred by @morlay
This commit is contained in:
Morlay 2020-12-29 18:01:58 +08:00 committed by GitHub
parent 39376be345
commit 3edd0eca47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 1 deletions

53
.github/workflows/docker-publish.yml vendored Normal file
View file

@ -0,0 +1,53 @@
name: Docker publish to docker.io
on:
push:
paths:
- .github/workflows/docker-publish.yml
- 'src/**'
- 'conf/**'
- 'types/**',
- 'docker-bin/**'
- 'bin/**'
- 'package.json'
- 'yarn.lock'
branches:
- '**'
tags:
- 'v*'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- uses: docker/login-action@v1
name: Login docker.io
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Prepare docker image tags
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ${{ github.repository }}
tag-custom: 4.x-next
tag-custom-only: ${{ github.ref == 'refs/heads/master' }}
tag-semver: |
{{version}}
{{major}}
{{major}}.{{minor}}
- name: Build & Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

View file

@ -1,4 +1,4 @@
FROM node:14.15.1-alpine as builder FROM --platform=${BUILDPLATFORM:-linux/amd64} node:14.15.1-alpine as builder
ENV NODE_ENV=production \ ENV NODE_ENV=production \
VERDACCIO_BUILD_REGISTRY=https://registry.verdaccio.org VERDACCIO_BUILD_REGISTRY=https://registry.verdaccio.org