Docker Image CI/CD for timescale + postgis image #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI/CD for timescale + postgis image | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
strategy: | |
matrix: | |
dockerfile: ['Dockerfile.pg13-ts2.12', 'Dockerfile.pg14-ts2.12','Dockerfile.pg15-ts2.12'] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract version from Dockerfile name | |
id: extract_version | |
run: | | |
version="${{ matrix.dockerfile }}" | |
version="${version#Dockerfile.}" # Remove "Dockerfile." prefix if it exists | |
echo "::set-output name=version::${version}" | |
shell: bash | |
- name: Build and Publish | |
uses: docker/build-push-action@v4 | |
with: | |
file: ${{ matrix.dockerfile }} | |
platforms: linux/amd64 | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ steps.extract_version.outputs.version }} |