Skip to content

Commit

Permalink
Making Docker push only if Dockerfile changed
Browse files Browse the repository at this point in the history
  • Loading branch information
flavienbwk committed Sep 21, 2024
1 parent 52c5903 commit 22ecfe3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,3 @@ jobs:
- name: Docker-compose build
run: |
docker compose build
- name: Log in to GitHub Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push nginx image to GitHub Container Registry
if: github.ref == 'refs/heads/main'
run: |
docker push ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:$(grep -oP "(?<=image: ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:).*" docker-compose.yml)
34 changes: 34 additions & 0 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Docker build of nginx-keycloak

on:
push:
branches:
- main
paths:
- 'Dockerfile'

jobs:

docker-build:
name: Ubuntu 22.04 build of nginx-keycloak
runs-on: ubuntu-22.04

steps:

- name: Check Out Repo
uses: actions/checkout@v2

- name: Docker-compose build
run: |
docker compose build
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push nginx image to GitHub Container Registry
run: |
docker push ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:$(grep -oP "(?<=image: ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:).*" docker-compose.yml)

0 comments on commit 22ecfe3

Please sign in to comment.