Update docker-image.yml #3
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: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the repository code | |
- uses: actions/checkout@v4 | |
# Set up Docker Buildx (for advanced Docker build features) | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Log in to GHCR using Personal Access Token (PAT) | |
- name: Log in to GitHub Container Registry | |
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
# Build the Docker image and tag it with the current date | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag ghcr.io/${{ github.repository }}/go-qr-web:latest | |
# Push the Docker image to GHCR | |
- name: Push to GitHub Container Registry | |
run: docker push ghcr.io/${{ github.repository }}/go-qr-web:latest |