build: alterando dockerfile e mavem file para build #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
push: | |
branches: ["release/*"] | |
tags: ["v*.*.*"] | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
BuildDockerImage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up docker builder | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 | |
- name: Log into docker hub | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d | |
with: | |
username: ${{ secrets.USER_DOCKER_HUB }} | |
password: ${{ secrets.TOKEN_DOCKER_HUB }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 | |
with: | |
images: ${{ secrets.USER_DOCKER_HUB }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
PublishDockerImage: | |
needs: BuildDockerImage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Sign and publish Docker image | |
env: | |
TAGS: ${{ steps.meta.outputs.tags }} | |
DIGEST: ${{ steps.build-and-push.outputs.digest }} | |
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |