Skip to content

Commit

Permalink
Merge branch 'single-docker-container'
Browse files Browse the repository at this point in the history
  • Loading branch information
sirux88 committed Sep 20, 2023
2 parents b06fd12 + 1e92aff commit 3966c82
Showing 1 changed file with 62 additions and 11 deletions.
73 changes: 62 additions & 11 deletions .github/workflows/docker-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,62 @@ env:
DOCKER_PUSH: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set DOCKER_PUSH for workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "DOCKER_PUSH=${{ github.event.inputs.dockerPush }}" >> $GITHUB_ENV

- name: Login to DockerHub
uses: docker/login-action@v2
if: ${{env.DOCKER_PUSH == 'true'}}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Populate Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKER_USERNAME }}/pwpush
flavor: |
latest=false
tags: |
type=match,pattern=release
type=schedule,pattern=latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern=latest
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
file: ./containers/docker/pwpush/Dockerfile
platforms: linux/amd64 #,linux/arm64
provenance: false
push: ${{env.DOCKER_PUSH == 'true'}}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/pwpush:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/pwpush:buildcache,mode=max,ignore-error=${{env.DOCKER_PUSH == 'false'}}
buildObsolete:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- imageName: pwpush
- imageName: pwpush-ephemeral
- imageName: pwpush-mysql
- imageName: pwpush-postgres
Expand All @@ -45,6 +95,13 @@ jobs:
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "DOCKER_PUSH=${{ github.event.inputs.dockerPush }}" >> $GITHUB_ENV

- name: Login to DockerHub
uses: docker/login-action@v2
if: ${{env.DOCKER_PUSH == 'true'}}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Populate Docker metadata
id: meta
uses: docker/metadata-action@v4
Expand All @@ -61,21 +118,15 @@ jobs:
type=semver,pattern=latest
type=sha
- name: Login to DockerHub
uses: docker/login-action@v2
if: ${{env.DOCKER_PUSH == 'true'}}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push ${{ matrix.imageName }} Docker images
uses: docker/build-push-action@v4
with:
file: ./containers/docker/${{ matrix.imageName }}/Dockerfile
platforms: linux/amd64,linux/arm64
platforms: linux/amd64 #,linux/arm64
provenance: false
push: ${{env.DOCKER_PUSH == 'true'}}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/${{ matrix.imageName }}:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/${{ matrix.imageName }}:buildcache,mode=max,ignore-error=${{env.DOCKER_PUSH == 'false'}}
build-context: pwpush=docker-image://${{ secrets.DOCKER_USERNAME }}/pwpush:${{ steps.meta.outputs.tags }}
# cache-from: type=localregistry,ref=${{ secrets.DOCKER_USERNAME }}/${{ matrix.imageName }}:buildcache
# cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/${{ matrix.imageName }}:buildcache,mode=max,ignore-error=${{env.DOCKER_PUSH == 'false'}}

0 comments on commit 3966c82

Please sign in to comment.