Update docker.yml
This commit is contained in:
@@ -106,30 +106,33 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v1
|
||||
-
|
||||
name: Login to DockerHub
|
||||
if: ${{ inputs.dockerhub-enable }}
|
||||
if: $${{ github.event_name != 'pull_request' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ inputs.dockerhub-username }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Login to GHCR
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
|
||||
-
|
||||
name: Docker meta
|
||||
id: docker_meta
|
||||
uses: docker/metadata-action@v3.6.2
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
images: ${{ inputs.image-names }}
|
||||
flavor: |
|
||||
latest=false
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
# -
|
||||
# name: Docker meta
|
||||
# id: docker_meta
|
||||
# uses: docker/metadata-action@v3.6.2
|
||||
# with:
|
||||
# # list of Docker images to use as base name for tags
|
||||
# images: ${{ inputs.image-names }}
|
||||
# flavor: |
|
||||
# latest=false
|
||||
# tags: |
|
||||
# type=raw,value=latest
|
||||
|
||||
|
||||
-
|
||||
# this will build the images, once per platform,
|
||||
# then push to both Docker Hub and GHCR
|
||||
@@ -137,19 +140,17 @@ jobs:
|
||||
id: docker_build_and_push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
platforms: ${{ inputs.platforms }}
|
||||
context: ${{ inputs.context }}
|
||||
target: ${{ inputs.target }}
|
||||
file: ${{ inputs.file }}
|
||||
platforms: linux/amd64
|
||||
context: app
|
||||
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: ${{ inputs.dockerhub-enable }}
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: buzzerburger/test:latest
|
||||
# labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
-
|
||||
name: Show image digest
|
||||
run: echo ${{ steps.docker_build_and_push.outputs.digest }}
|
||||
|
||||
Reference in New Issue
Block a user