Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
nihaldivyam committed Jul 19, 2024
1 parent 00eb18d commit 395f029
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 18 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Docker Image CI

on:
push:
branches: [ "v1.0.4" ]

jobs:
docker:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/[email protected]

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

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

- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }} # github username or org
password: ${{ secrets.GITHUB_TOKEN }} # github actions builtin token. repo has to have pkg access.

- name: Prepare
id: prep
run: |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Build and push
id: docker_build
uses: docker/[email protected]
with:
context: .
file: ./postgres-logical-backup/Dockerfile
platforms: linux/amd64
pull: true # Pull new version of base image, always; avoid bit-rot
push: true
labels: |
org.opencontainers.image.title=${{ github.repository }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
cache-from: type=gha # all-automatic Github Actions caching
cache-to: type=gha,mode=max
build-args: |
tags: ghcr.io/obmondo/postgres-logical-backup:latest
35 changes: 17 additions & 18 deletions .github/workflows/postgres-logical-backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Build Logical backup

on:
push:
branches: [ "v1.0.4" ]
paths: 'postgres-logical-backup/**'
branches: [ "*" ]
paths: 'logical-backup/**'
tags: [ "v*" ]

jobs:
Expand All @@ -17,17 +17,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# - name: Generate container metadata
# id: meta
# uses: docker/metadata-action@v3
# with:
# images: ghcr.io/obmondo/logical-backup
# tags: |
# type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }}
# type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
# type=ref,event=tag
# flavor: |
# latest=false
- name: Generate container metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/obmondo/logical-backup
tags: |
type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }}
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=tag
flavor: |
latest=false
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
Expand All @@ -39,9 +39,8 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
file: "./postgres-logical-backup/Dockerfile"
file: "./logical-backup/Dockerfile"
context: .
tags: ghcr.io/obmondo/postgres-logical-backup:latest
# labels: ${{ steps.meta.outputs.labels }}
# push: true
# tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit 395f029

Please sign in to comment.