Skip to content

Commit

Permalink
have to pull image from private repo after pushing to it then can re-tag
Browse files Browse the repository at this point in the history
  • Loading branch information
cfindlayisme committed Jun 1, 2024
1 parent c22830c commit 968423d
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,43 +116,45 @@ jobs:
if: success()

build-and-push:
needs: build-and-scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Repository
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build Docker images
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_REPO }}:latest
- name: Login to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag and push the Docker image to GitHub Packages
run: |
docker tag ${{ secrets.DOCKER_REPO }}:latest ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:latest
if: github.ref == 'refs/heads/main'
- name: Notify IRC
run: |
export COMMIT_MSG=$(git log -1 --pretty=%B)
export MESSAGE="Build and push of ${{ secrets.DOCKER_REPO }}:latest completed with commit message: $COMMIT_MSG. See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
curl -X POST -H "Content-Type: application/json" -d "{\"message\": \"$MESSAGE\", \"password\": \"${{ secrets.WMB_PASSWORD }}\", \"colourcode\": 3}" https://convos.findlayis.me/wmb/message
if: success()
needs: build-and-scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Repository
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build Docker images
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_REPO }}:latest
- name: Pull the Docker image from Docker Repository
run: docker pull ${{ secrets.DOCKER_REPO }}:latest
- name: Login to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag and push the Docker image to GitHub Packages
run: |
docker tag ${{ secrets.DOCKER_REPO }}:latest ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:latest
if: github.ref == 'refs/heads/main'
- name: Notify IRC
run: |
export COMMIT_MSG=$(git log -1 --pretty=%B)
export MESSAGE="Build and push of ${{ secrets.DOCKER_REPO }}:latest completed with commit message: $COMMIT_MSG. See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
curl -X POST -H "Content-Type: application/json" -d "{\"message\": \"$MESSAGE\", \"password\": \"${{ secrets.WMB_PASSWORD }}\", \"colourcode\": 3}" https://convos.findlayis.me/wmb/message
if: success()

deploy:
needs: [build-and-push]
Expand Down

0 comments on commit 968423d

Please sign in to comment.