Update main.yml #23
This file contains hidden or 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: Build and Push Docker Image | ||
| on: | ||
| push: | ||
| branches: | ||
| - main # Trigger the workflow on pushes to the main branch | ||
| env: | ||
| DOCKER_IMAGE_NAME: ivanpiskunov/sectools # Replace with your details | ||
| DOCKER_TAG: ${{ github.sha }} # Use commit SHA as a tag, or latest for a fixed tag | ||
| jobs: | ||
| build_and_push: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| # registry: https://hub.docker.com | ||
| username: ivanpiskunov # ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: $lMjW76CP#%94x@t # ${{ secrets.DOCKER_TOKEN }} | ||
| logout: true | ||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . # Path to your Dockerfile, '.' for current directory | ||
| push: true | ||
| tags: | ||
| ${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_TAG }} | ||
| ${{ env.DOCKER_IMAGE_NAME }}:latest # Optionally push with 'latest' tag | ||
| build-args: | | ||
| # Add any build arguments here, e.g., MY_ARG=value | ||