Skip to content

Postgres

Postgres #76

Workflow file for this run

name: Publish Docker image prod
on:
pull_request:
branches:
- main # Trigger on PR to main branch
# You can still keep `workflow_dispatch` here for manual triggers later, if you need
# workflow_dispatch:
jobs:
push_to_registries:
name: Push Docker image to ghcr.io
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
install: true
driver-opts: network=host
platforms: linux/amd64,linux/arm64
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- name: Build and push Docker images
id: push
uses: docker/[email protected]
with:
context: .
file: Dockerfile.prod # Specify the production Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.tags }} # Version tags (e.g., v1.0.0)
ghcr.io/${{ github.repository }}:prod # Prod tag
labels: |
version=${{ steps.meta.outputs.tags }}
environment=production # Add production-related labels
platforms: linux/amd64,linux/arm64