Skip to content

Commit

Permalink
Create docker-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nikeee authored Mar 19, 2021
1 parent 5dd38b7 commit 81af707
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Docker

on:
push:
branches:
- master
tags:
- v*

env:
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}

jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Cache docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up `docker buildx`
uses: docker/setup-buildx-action@v1

- name: Login to registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
mkdir -p /tmp/.buildx-cache
IMAGE_TAG="ghcr.io/$REGISTRY_USER/docker-nginx-spa:latest"
docker buildx build . \
-f Dockerfile \
--push \
--platform linux/arm/v7,linux/arm/v6,linux/amd64 \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,mode=max,dest=/tmp/.buildx-cache \
--label org.opencontainers.image.revision=${{ github.sha }} \
--label org.opencontainers.image.source="https://github.com/${{ github.repository }}" \
-t "${IMAGE_TAG}"
# Push

0 comments on commit 81af707

Please sign in to comment.