Skip to content

Commit

Permalink
Update docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ljubomirb authored Sep 8, 2024
1 parent fae5bdd commit a89fb91
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@ jobs:
runs-on: ubuntu-latest

steps:
# Check out the repository code
- uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and push Docker image
run: |
docker build . --file Dockerfile --tag ghcr.io/${{ github.repository }}/go-qr-web:latest
docker push ghcr.io/${{ github.repository }}/go-qr-web:latest
# 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

0 comments on commit a89fb91

Please sign in to comment.