Skip to content

fix: vulnerabilidades e conflitos #79

fix: vulnerabilidades e conflitos

fix: vulnerabilidades e conflitos #79

Workflow file for this run

name: Docker Image CI/CD
on:
push:
branches: [ "main" ]
tags:
- 'v*'
release:
types: [ published ]
pull_request:
branches: [ "main" ]
jobs:
login:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Define Docker Image Name
id: image_name
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/* ]]; then
echo "IMAGE_NAME=${{ github.repository }}:${{ github.ref_name }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "release" ]; then
echo "IMAGE_NAME=${{ github.repository }}:${{ github.event.release.tag_name }}" >> $GITHUB_ENV
else
echo "IMAGE_NAME=${{ github.repository }}:$(echo $GITHUB_SHA | head -c7)" >> $GITHUB_ENV
fi
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Push the Docker image
run: |
docker push $IMAGE_NAME
- name: Tag image as latest
if: github.ref == 'refs/heads/main'
run: |
docker tag $IMAGE_NAME ${{ github.repository }}:latest
docker push ${{ github.repository }}:latest