♻️ major refactor #9
This file contains hidden or 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: Build and Push Docker Images | |
| on: | |
| push: | |
| branches: [ master ] | |
| paths: | |
| - 'Dockerfile' | |
| - '.github/workflows/docker-build.yml' | |
| workflow_dispatch: | |
| env: | |
| IMAGE_NAME: rushilsrivastava/postgres-cloudsql | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - pg_major: 14 | |
| postgis_version: 3.5 | |
| hll_version: 2.18 | |
| - pg_major: 15 | |
| postgis_version: 3.5 | |
| hll_version: 2.18 | |
| - pg_major: 16 | |
| postgis_version: 3.5 | |
| hll_version: 2.18 | |
| - pg_major: 17 | |
| postgis_version: 3.5 | |
| hll_version: 2.18 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| buildkitd-flags: --debug | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Determine PostgreSQL full version | |
| id: pg_version | |
| run: | | |
| PG_FULL_VERSION=$(docker run --rm postgis/postgis:${{ matrix.pg_major }}-${{ matrix.postgis_version }} postgres -V | awk '{print $3}') | |
| echo "pg_full_version=${PG_FULL_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=${{ matrix.pg_major }} | |
| type=raw,value=${{ steps.pg_version.outputs.pg_full_version }} | |
| labels: | | |
| org.opencontainers.image.title=PostGIS with pg_cron and postgres_hll | |
| org.opencontainers.image.description=PostgreSQL ${{ matrix.pg_major }} with PostGIS ${{ matrix.postgis_version }}, pg_cron and postgres_hll | |
| org.opencontainers.image.version=${{ matrix.pg_major }}-postgis${{ matrix.postgis_version }}-hll${{ matrix.hll_version }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| build-args: | | |
| PG_VERSION=${{ matrix.pg_major }} | |
| POSTGIS_VERSION=${{ matrix.postgis_version }} | |
| HLL_VERSION=${{ matrix.hll_version }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: | | |
| type=registry,ref=${{ env.IMAGE_NAME }}:buildcache-${{ matrix.pg_major }} | |
| cache-to: | | |
| type=registry,ref=${{ env.IMAGE_NAME }}:buildcache-${{ matrix.pg_major }},mode=max |