chore(actions): use buildx for building docker images

This commit is contained in:
Łukasz Mierzwa
2020-11-22 16:43:24 +00:00
committed by Łukasz Mierzwa
parent d096c4b69a
commit 771b38cd21
2 changed files with 31 additions and 34 deletions

View File

@@ -611,44 +611,43 @@ jobs:
- name: Set git slug envs
uses: rlespinasse/github-slug-action@3.1.0
- name: Build Docker image
run: make docker-image
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1.8.4
with:
images: |
lmierzwa/karma
ghcr.io/prymitive/karma
- name: "Tag :latest for Docker Hub"
run: docker tag karma:latest lmierzwa/karma:latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: "Tag :vX.Y for Docker Hub"
if: github.event_name == 'release'
run: docker tag karma:latest lmierzwa/karma:${{ env.GITHUB_REF_SLUG }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
shell: bash
run: echo "${DOCKER_HUB_PASSWORD}" | docker login -u lmierzwa --password-stdin
env:
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Push Docker image to Docker Hub
if: github.event_name != 'pull_request'
run: docker push lmierzwa/karma
- name: "Tag :latest for GitHub Container Registry"
run: docker tag karma:latest ghcr.io/prymitive/karma:latest
- name: "Tag :vX.Y for GitHub Container Registry"
if: github.event_name == 'release'
run: docker tag karma:latest ghcr.io/prymitive/karma:${{ env.GITHUB_REF_SLUG }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: lmierzwa
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
shell: bash
run: echo "${GH_PKG_TOKEN}" | docker login ghcr.io -u prymitive --password-stdin
env:
GH_PKG_TOKEN: ${{ secrets.GH_PKG_TOKEN }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PKG_TOKEN }}
- name: Push Docker image to GitHub Container Registry
if: github.event_name != 'pull_request'
run: docker push ghcr.io/prymitive/karma
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
demo-deploy:
name: Deploy demo app to Heroku