Skip to content

Docker Image PostgreSQL #124

Docker Image PostgreSQL

Docker Image PostgreSQL #124

Workflow file for this run

name: Docker Image PostgreSQL
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * *" # 6 AM Daily
push:
paths:
- postgres/**
- .github/workflows/postgres.yml
jobs:
postgres:
name: PostgreSQL
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- "16"
- "15"
- "14"
- "13"
- "12"
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ !env.ACT }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: ${{ !env.ACT }}
- name: Set build-args
run: |-
ESCAPED_VERSION="$(echo ${{ matrix.version }} | sed 's/\./\\\./g')"
POSTGRES_VERSION=$(
docker run --rm gcr.io/go-containerregistry/crane:v0.8.0 ls postgres \
| egrep "^${ESCAPED_VERSION}(\.[0-9]+)?(-alpine)?\$" | sort -Vr | head -n1
)
echo "POSTGRES_VERSION=${POSTGRES_VERSION}" | tee /dev/stderr >> $GITHUB_ENV
- uses: docker/build-push-action@v3
with:
context: postgres
platforms: linux/amd64,linux/arm64
build-args: POSTGRES_VERSION=${{ env.POSTGRES_VERSION }}
push: ${{ github.ref == 'refs/heads/main' && !env.ACT }}
tags: ghcr.io/${{ github.repository_owner }}/postgres:${{ matrix.version }},wardenenv/postgres:${{matrix.version}}