Skip to content

Add starting database image #4

Add starting database image

Add starting database image #4

Workflow file for this run

name: CI/CD database docker image
on:
push:
paths:
- ".github/workflows/database.yml"
- "infra/docker/database/*"
jobs:
build:
name: Build database image
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- pg_major: "11"
timescaledb_version: "1.7.4"
postgis_version: "2.5.5"
dockerfile: "pg11.Dockerfile"
image_tag: "pg11-ts1.7.4-postgis2.5.5"
- pg_major: "11"
timescaledb_version: "2.3.1"
postgis_version: "3.3.6"
dockerfile: "pg11.Dockerfile"
image_tag: "pg11-ts2.3.1-postgis3.3.6"
- pg_major: "13"
timescaledb_version: "2.14.2"
postgis_version: "3.4.2"
dockerfile: "pg13_16.Dockerfile"
image_tag: "pg13-ts2.14.2-postgis3.4.2"
- pg_major: "16"
timescaledb_version: "2.14.2"
postgis_version: "3.4.2"
dockerfile: "pg13_16.Dockerfile"
image_tag: "pg16-ts2.14.2-postgis3.4.2"
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set IMAGE_TAG
run: echo "IMAGE_TAG=ghcr.io/mtes-mct/monitorfish/monitorfish-database:${{ matrix.image_tag }}" >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
# - name: Cache Docker layers
# uses: actions/cache@v4
# with:
# path: /tmp/.buildx-cache-database
# key: ${{ runner.os }}-single-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-single-buildx
- name: Build image
uses: docker/build-push-action@v5
with:
context: .
load: true
builder: ${{ steps.buildx.outputs.name }}
file: infra/docker/database/${{ matrix.dockerfile }}
push: false
tags: ${{ env.IMAGE_TAG }}
build-args: |
PG_MAJOR=${{ matrix.pg_major }}
TIMESCALEDB_VERSION=${{ matrix.timescaledb_version }}
POSTGIS_VERSION=${{ matrix.postgis_version }}
# cache-from: type=local,src=/tmp/.buildx-cache-database
# cache-to: type=local,dest=/tmp/.buildx-cache-database-new
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
# - name: Move cache
# run: |
# rm -rf /tmp/.buildx-cache-database
# mv /tmp/.buildx-cache-database-new /tmp/.buildx-cache-database
- name: Push docker image to registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${GITHUB_ACTOR} --password-stdin
docker push ${{ env.IMAGE_TAG }}