Update docker.yml

This commit is contained in:
Nobix
2022-04-08 05:53:15 +05:30
committed by GitHub
parent c13a9b7e20
commit 6eb7571833
+34 -21
View File
@@ -105,14 +105,14 @@ jobs:
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- # -
name: Login to GHCR # name: Login to GHCR
if: github.event_name != 'pull_request' # if: github.event_name != 'pull_request'
uses: docker/login-action@v1 # uses: docker/login-action@v1
with: # with:
registry: ghcr.io # registry: ghcr.io
username: ${{ secrets.DOCKERHUB_USERNAME }} # username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} # password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Docker meta name: Docker meta
id: docker_meta id: docker_meta
@@ -127,26 +127,39 @@ jobs:
tags: | tags: |
type=raw,value=latest type=raw,value=latest
- # -
# this will build the images, once per platform, # # this will build the images, once per platform,
# then push to both Docker Hub and GHCR # # then push to both Docker Hub and GHCR
name: Docker Build and Push # name: Docker Build and Push
id: docker_build_and_push # id: docker_build_and_push
# uses: docker/build-push-action@v2
# with:
# platforms: linux/amd64
# context: app
# target: ${{ inputs.target }}
# file: ${{ inputs.file }}
# builder: ${{ steps.buildx.outputs.name }}
# # it uses github cache API for faster builds:
# # https://github.com/crazy-max/docker-build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
# cache-from: type=gha
# cache-to: type=gha,mode=max
# # for an approved pull_request, only push pr-specific tags
# push: ${{ github.event_name != 'pull_request' }}
# tags: buzzerburger/test:latest
# # labels: ${{ steps.docker_meta.outputs.labels }}
- name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
platforms: linux/amd64 context: .
context: app platforms: linux/amd64,linux/arm64
target: ${{ inputs.target }} push: true
file: ${{ inputs.file }} tags: user/app:latest
builder: ${{ steps.buildx.outputs.name }}
# it uses github cache API for faster builds:
# https://github.com/crazy-max/docker-build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
# for an approved pull_request, only push pr-specific tags # for an approved pull_request, only push pr-specific tags
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: buzzerburger/test:latest tags: buzzerburger/test:latest
# labels: ${{ steps.docker_meta.outputs.labels }}
- -
name: Show image digest name: Show image digest
run: echo ${{ steps.docker_build_and_push.outputs.digest }} run: echo ${{ steps.docker_build_and_push.outputs.digest }}