From 0681a3dd8e36e1e909ecc28c167000bb4cf0bf98 Mon Sep 17 00:00:00 2001 From: Ruben Nijveld Date: Fri, 12 Apr 2024 16:17:26 +0200 Subject: [PATCH] Initial commit --- .github/dependabot.yml | 7 +++++++ .github/workflows/build-push.yml | 17 +++++++++++++++++ .github/workflows/check.yml | 12 ++++++++++++ .github/workflows/container-cleanup.yml | 16 ++++++++++++++++ .github/workflows/docker.yml | 25 +++++++++++++++++++++++++ Dockerfile | 20 ++++++++++++++++++++ LICENSE | 25 +++++++++++++++++++++++++ README.md | 18 ++++++++++++++++++ 8 files changed, 140 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build-push.yml create mode 100644 .github/workflows/check.yml create mode 100644 .github/workflows/container-cleanup.yml create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3eb9d4e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml new file mode 100644 index 0000000..7bd2591 --- /dev/null +++ b/.github/workflows/build-push.yml @@ -0,0 +1,17 @@ +name: Build and push + +permissions: + contents: read + packages: write + +on: + push: + branches: + - main + schedule: + - cron: '30 2 * * SUN' + +jobs: + build-and-push: + uses: ./.github/workflows/docker.yml + secrets: inherit diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..ac51988 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,12 @@ +name: Checks + +permissions: + contents: read + +on: + pull_request: + +jobs: + build: + uses: ./.github/workflows/docker.yml + secrets: inherit diff --git a/.github/workflows/container-cleanup.yml b/.github/workflows/container-cleanup.yml new file mode 100644 index 0000000..e569d39 --- /dev/null +++ b/.github/workflows/container-cleanup.yml @@ -0,0 +1,16 @@ +name: Container Registry Cleanup + +permissions: + contents: read + packages: write + +on: + workflow_dispatch: + schedule: + - cron: '30 2 * * MON' + +jobs: + untagged-cleanup: + uses: "tweedegolf/actions-container-helpers/.github/workflows/container-untagged-cleanup.yml@main" + with: + package: postgres diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..28efd3d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,25 @@ +name: Docker + +on: + workflow_call: + +jobs: + docker: + strategy: + matrix: + include: + - postgresql_version: 16 + latest: true + - postgresql_version: 15 + latest: false + - postgresql_version: 14 + latest: false + uses: "tweedegolf/actions-container-helpers/.github/workflows/container-image.yml@main" + with: + push: ${{ github.ref == 'refs/heads/main' }} + platforms: "linux/amd64,linux/arm64" + build-args: | + PG_MAJOR=${{matrix.postgresql_version}} + tags: | + ghcr.io/tweedegolf/postgres:${{matrix.postgresql_version}} + ${{ matrix.latest && 'ghcr.io/tweedegolf/postgres:latest' || '' }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f188d67 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +ARG PG_MAJOR + +FROM postgres:${PG_MAJOR} + +ARG PG_MAJOR +ENV PG_MAJOR ${PG_MAJOR} + +ENV POSTGIS_VERSION 3 + +RUN apt-get update -y \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + postgis \ + postgresql-${PG_MAJOR}-postgis-${POSTGIS_VERSION} \ + postgresql-${PG_MAJOR}-postgis-${POSTGIS_VERSION}-scripts \ + postgresql-${PG_MAJOR}-pgrouting \ + postgresql-${PG_MAJOR}-pgrouting-scripts \ + postgresql-${PG_MAJOR}-rational \ + postgresql-${PG_MAJOR}-icu-ext \ + postgresql-${PG_MAJOR}-toastinfo \ + && rm -rf /var/lib/apt/lists/* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..28e9412 --- /dev/null +++ b/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2024 Tweede Golf and Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..033acd9 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# PostgresSQL with extensions docker image +This repository contains the source docker config for a postgresql image with +some often used additional extensions installed. It can be used for both +production and development purposes. Currently these versions are supported +with the tags listed: + +* 16: `16`, `latest` +* 15: `15` +* 14: `14` + +The following extensions are available within PostgreSQL: + +* postgis - https://postgis.net/ +* pgrouting - https://pgrouting.org/ +* pg_rational - https://github.com/begriffs/pg_rational +* icu_ext - https://github.com/dverite/icu_ext +* toastinfo - https://github.com/credativ/toastinfo +* Supplied Modules - https://www.postgresql.org/docs/current/contrib.html