diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..724c537a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,176 @@ +# .circleci/config.yml + +# Circle CI arm64 builder +version: 2.1 + +orbs: + # https://circleci.com/developer/orbs/orb/circleci/docker + docker: circleci/docker@2.7.1 + # https://circleci.com/developer/orbs/orb/circleci/python + python: circleci/python@2.1.1 + # https://circleci.com/developer/orbs/orb/circleci/shellcheck + shellcheck: circleci/shellcheck@3.2.0 + +jobs: + build-arm64: + # We limit this to prevent overloading external servers (e.g., OSGeo, PROJ). + # Note: Include parallel GitHub CI jobs when calculating the total load, as they run simultaneously! + parallelism: 8 + machine: + image: ubuntu-2204:current + resource_class: arm.large + environment: + BUILDX_PLATFORMS: linux/arm64v8 + DOCKER_BUILDKIT: '1' + PLATFORM: linux/arm64v8 + parameters: + target-version-variant: + type: string + steps: + - checkout + + - run: + name: Display pipeline.* values + command: | + echo 'pipeline.git.branch: <>' + echo 'pipeline.git.revision: <>' + echo 'pipeline.id: <>' + echo 'pipeline.project.git_url: <>' + echo 'pipeline.trigger_source: <>' + echo 'pipeline.schedule.name:<< pipeline.schedule.name >>' + echo 'pipeline.schedule.id:<< pipeline.schedule.id >>' + + - docker/check: + registry: docker.io + docker-username: DOCKERHUB_USERNAME + docker-password: DOCKERHUB_ACCESS_TOKEN + + - run: + name: Docker Ratelimit Check - before + # https://docs.docker.com/docker-hub/download-rate-limit/ + command: | + TOKEN=$(curl --user "$DOCKERHUB_USERNAME:$DOCKERHUB_ACCESS_TOKEN" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token) + HEADERS=$(curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest) + echo "Rate Limit Info:" + echo "$HEADERS" | grep ratelimit + + - run: uname -a + - run: docker --version + - run: docker info + - run: pip3 install --upgrade pip + - run: pip3 install --upgrade lastversion + - run: tools/install_manifest-tool.sh + - run: tools/install_dive.sh + - run: tools/environment_init.sh + - run: make check_version + + - run: + name: Conditional Docker Check - Halt if not on master branch or if it's a PR or Weekly image exists + command: | + # Check if the current branch is 'master' and the weekly image is not extis + # If weekly image exists, skip docker build and push + source tools/environment_init.sh + echo "check: << parameters.target-version-variant >>${IMAGE_VERSION_ID}" + check_image_exists "<< parameters.target-version-variant >>${IMAGE_VERSION_ID}" || true + if [ "$CIRCLE_BRANCH" == "master" ] && check_image_exists "<< parameters.target-version-variant >>${IMAGE_VERSION_ID}"; then + circleci-agent step halt + fi + + - run: make -n test-<< parameters.target-version-variant >> + - run: make test-<< parameters.target-version-variant >> + - run: make scan-<< parameters.target-version-variant >> || true + - run: make dive-<< parameters.target-version-variant >> || true + - run: docker images + + - run: + name: Conditional Docker Check - Halt if not on master branch or if it's a PR + command: | + # Check if the current branch is NOT 'master' or if the build is triggered by a pull request. + # If either of these conditions is met, halt the workflow. + if [ "$CIRCLE_BRANCH" != "master" ] || [ -n "$CIRCLE_PULL_REQUEST" ]; then + circleci-agent step halt + fi + + - run: + name: "Push docker image : make push-<< parameters.target-version-variant >>" + command: | + if [ "$CIRCLE_BRANCH" == "master" ] && [ -z "$CIRCLE_PULL_REQUEST" ]; then + make push-<< parameters.target-version-variant >> + make manifest-<< parameters.target-version-variant >> + echo "...push and manifest done..." + fi + + - run: + name: Docker Ratelimit Check - after + # https://docs.docker.com/docker-hub/download-rate-limit/ + command: | + TOKEN=$(curl --user "$DOCKERHUB_USERNAME:$DOCKERHUB_ACCESS_TOKEN" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token) + HEADERS=$(curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest) + echo "Rate Limit Info:" + echo "$HEADERS" | grep ratelimit + + +workflows: + build-deploy: +# AND triggered by the app.circleci.com UI +# daily run : Repeats everyday every month ; 6:00am UTC, 1 (once per hour). + jobs: + - build-arm64: + matrix: + parameters: + target-version-variant: [ +# +# They are created using the ./apply-ci.sh script based on the version.json file, +# where the architecture is defined as "arm64". +# These "--skip--" images serve as inputs for the "*-bundle" images, +# hence they must be generated within the bundle JOB. +# +#circleci-targets-start + "12-3.3-alpine3.20", + "12-3.4-alpine3.19", + "12-3.4-alpine3.20", + "12-3.5-alpine3.19", + "12-3.5-alpine3.20", + "12-3.5-bookworm", + "12-3.5-bullseye", + "13-3.3-alpine3.20", + "13-3.4-alpine3.19", + "13-3.4-alpine3.20", + "13-3.5-alpine3.19", + "13-3.5-alpine3.20", + "13-3.5-bookworm", + "13-3.5-bullseye", + "14-3.3-alpine3.20", + "14-3.4-alpine3.19", + "14-3.4-alpine3.20", + "14-3.5-alpine3.19", + "14-3.5-alpine3.20", + "14-3.5-bookworm", + "14-3.5-bullseye", + "14-l3.1.9gcp-bookworm", + "15-3.3-alpine3.20", + "15-3.4-alpine3.19", + "15-3.4-alpine3.20", + "15-3.5-alpine3.19", + "15-3.5-alpine3.20", + "15-3.5-bookworm", + "15-3.5-bullseye", + "16-3.3-alpine3.20", + "16-3.4-alpine3.19", + "16-3.4-alpine3.20", + "16-3.5-alpine3.19", + "16-3.5-alpine3.20", +# --skip-- "16-3.5-bookworm", --> generated with the related bundle job! + "16-3.5-bullseye", + "16-3.5-bundle0-bookworm", + "16-master-bookworm", + "16-recent-bookworm", + "17-3.4-alpine3.20", + "17-3.5-alpine3.19", + "17-3.5-alpine3.20", + "17-3.5-bookworm", + "17-3.5-bullseye", + "17-master-bookworm", + "17-recent-bookworm", +#circleci-targets-end + ] diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 00000000..b5eca3fe --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,36 @@ +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +# see - https://docs.coderabbit.ai/configure-coderabbit/ + +language: "en-US" + +early_access: true + +# we(docker-postgis) always need a human to approve (and merge), we don't use this, +reviews: + profile: "chill" + request_changes_workflow: false + high_level_summary: false + poem: false + review_status: false + collapse_walkthrough: true + auto_review: + enabled: false + drafts: false + +# chat is allowed +chat: + auto_reply: true + + +# https://docs.coderabbit.ai/guides/commands +# +# The following commands are available (invoked as PR comments): +# @coderabbitai pause : to pause the reviews on a PR. +# @coderabbitai resume : to resume the paused reviews. +# @coderabbitai review : to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. +# @coderabbitai full review : to do a full review from scratch and review all the files again. +# @coderabbitai summary : to regenerate the summary of the PR. +# @coderabbitai resolve : resolve all the CodeRabbit review comments. +# @coderabbitai configuration : to show the current CodeRabbit configuration for the repository. +# @coderabbitai help : to get help. + diff --git a/.dockerignore b/.dockerignore index 2de8e88c..6f46be0c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,21 @@ -Dockerfile .git _* +.jq-template.awk +.template-helper-functions.jq +.vscode/ + +.git/ +.github/ +.gitignore +.circleci/ + +docs/ +README.md +version.json + +Dockerfile.*.template +localetest.sh +apply-*.sh + +trivy_cache +tmp/ diff --git a/.env b/.env new file mode 100644 index 00000000..746da9e9 --- /dev/null +++ b/.env @@ -0,0 +1,22 @@ +# PROD setup +# +# Setup info, used by: +# ./update.sh and other scripts ( ./apply-*.sh ) +# ./Makefile +# ./.github/workflows/main.yml +# ./.circleci/config.yml +# +# IF your are changing the values, please run ./update.sh +# to update some hard coded values in the Dockerfiles or README.md +# + +REGISTRY=docker.io +REPO_NAME=imresamu +IMAGE_NAME=postgis +DOCKERHUB_README_REPOSITORY=imresamu/postgis + +dockerhublink='https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=' +githubrepolink='https://github.com/imresamu/docker-postgis/blob/master' + +ENABLE_IMAGE_ARCH=true +ENABLE_IMAGE_VERSION_ID=true diff --git a/.env.test b/.env.test new file mode 100644 index 00000000..e6f2a386 --- /dev/null +++ b/.env.test @@ -0,0 +1,23 @@ +# Test Setup ; if TEST=true +# +# Setup info, used by: +# ./update.sh and other scripts ( ./apply-*.sh ) +# ./Makefile +# ./.github/workflows/main.yml +# ./.circleci/config.yml +# +# IF your are changing the values, please run ./update.sh +# to update some hard coded values in the Dockerfiles or README.md +# + +REGISTRY=localhost:5000 +REPO_NAME=testrepo +IMAGE_NAME=testpostgisimage +DOCKERHUB_README_REPOSITORY=testrepo/testpostgisimage + +dockerhublink='https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=' +githubrepolink='https://github.com/postgis/docker-postgis/blob/master' + +ENABLE_IMAGE_ARCH=true +ENABLE_IMAGE_VERSION_ID=true + diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..16c09d08 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +# https://github.com/actions/checkout/issues/135#issuecomment-613361104 +* text eol=lf + +/*/**/Dockerfile linguist-generated +/*/**/initdb-postgis.sh linguist-generated +/*/**/update-postgis.sh linguist-generated +/*/**/tags linguist-generated +.github/workflows/main.yml linguist-generated +versions.json linguist-generated +README.md linguist-generated +/Dockerfile*.template linguist-language=Dockerfile diff --git a/.github/workflows/localtest.yml b/.github/workflows/localtest.yml new file mode 100644 index 00000000..96fe531e --- /dev/null +++ b/.github/workflows/localtest.yml @@ -0,0 +1,21 @@ +name: "Localtest" +# testing the workflow +on: + push: + pull_request: + schedule: + - cron: '15 5 * * 1' + +jobs: + localtest: + name: "testing ./localtest.sh ( update.sh and build test and push to local registry )" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - run: docker ps -a + - run: pip3 install --upgrade pip + - run: pip3 install --upgrade lastversion + - run: tools/install_manifest-tool.sh + - run: tools/environment_init.sh + - run: ./localtest.sh + - run: docker images diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5db918d6..0a78d655 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,62 +1,213 @@ -name: Docker PostGIS CI +name: Build PostGIS images + +# This is the x86_64/Amd64 build worklow on: push: pull_request: schedule: - - cron: '15 5 * * 1' + - cron: '15 5 * * *' defaults: run: shell: bash jobs: - make-docker-images: strategy: + # We limit this to prevent overloading external servers (e.g., OSGeo, PROJ). + # Note: Include parallel Circle CI jobs when calculating the total load, as they run simultaneously! + max-parallel: 6 matrix: - postgres: [12, 13, 14, 15, 16] - postgis: ['3.4'] - variant: [default, alpine] include: - - postgres: 15 - postgis: master - variant: default - - postgres: 16 - postgis: master - variant: default - - postgres: 11 - postgis: 3.3 - variant: default - - postgres: 11 - postgis: 3.3 - variant: alpine - - name: Build docker image for ${{ matrix.postgres }}-${{ matrix.postgis }} variant ${{ matrix.variant }} - runs-on: ubuntu-20.04 - continue-on-error: ${{ matrix.postgis == 'master' }} +# +# They are created using the ./apply-ci.sh script based on the version.json file, +# +# These "--skip--" images serve as inputs for the "*-bundle" images, +# hence they must be generated within the bundle JOB. +# +#matrix-include-start + - { version: "12-3.3", variant: "alpine3.20" } + - { version: "12-3.4", variant: "alpine3.19" } + - { version: "12-3.4", variant: "alpine3.20" } + - { version: "12-3.5", variant: "alpine3.19" } + - { version: "12-3.5", variant: "alpine3.20" } + - { version: "12-3.5", variant: "bookworm" } + - { version: "12-3.5", variant: "bullseye" } + - { version: "13-3.3", variant: "alpine3.20" } + - { version: "13-3.4", variant: "alpine3.19" } + - { version: "13-3.4", variant: "alpine3.20" } + - { version: "13-3.5", variant: "alpine3.19" } + - { version: "13-3.5", variant: "alpine3.20" } + - { version: "13-3.5", variant: "bookworm" } + - { version: "13-3.5", variant: "bullseye" } + - { version: "14-3.3", variant: "alpine3.20" } + - { version: "14-3.4", variant: "alpine3.19" } + - { version: "14-3.4", variant: "alpine3.20" } + - { version: "14-3.5", variant: "alpine3.19" } + - { version: "14-3.5", variant: "alpine3.20" } + - { version: "14-3.5", variant: "bookworm" } + - { version: "14-3.5", variant: "bullseye" } + - { version: "14-l3.1.9gcp", variant: "bookworm" } + - { version: "15-3.3", variant: "alpine3.20" } + - { version: "15-3.4", variant: "alpine3.19" } + - { version: "15-3.4", variant: "alpine3.20" } + - { version: "15-3.5", variant: "alpine3.19" } + - { version: "15-3.5", variant: "alpine3.20" } + - { version: "15-3.5", variant: "bookworm" } + - { version: "15-3.5", variant: "bullseye" } + - { version: "16-3.3", variant: "alpine3.20" } + - { version: "16-3.4", variant: "alpine3.19" } + - { version: "16-3.4", variant: "alpine3.20" } + - { version: "16-3.5", variant: "alpine3.19" } + - { version: "16-3.5", variant: "alpine3.20" } +# --skip-- - { version: "16-3.5", variant: "bookworm" } --> generated with the related bundle job! + - { version: "16-3.5", variant: "bullseye" } + - { version: "16-3.5-bundle0", variant: "bookworm" } + - { version: "16-master", variant: "bookworm" } + - { version: "16-recent", variant: "bookworm" } + - { version: "17-3.4", variant: "alpine3.20" } + - { version: "17-3.5", variant: "alpine3.19" } + - { version: "17-3.5", variant: "alpine3.20" } + - { version: "17-3.5", variant: "bookworm" } + - { version: "17-3.5", variant: "bullseye" } + - { version: "17-master", variant: "bookworm" } + - { version: "17-recent", variant: "bookworm" } +#matrix-include-end + + name: "${{ matrix.version }}-${{ matrix.variant }} docker image" + runs-on: ubuntu-22.04 + continue-on-error: ${{ endsWith(matrix.version, '-master') }} + env: + PLATFORM: linux/amd64 + DOCKER_BUILDKIT: '1' + BUILDX_PLATFORMS: linux/amd64 + + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - run: pip3 install --upgrade pip + - run: pip3 install --upgrade lastversion + - run: tools/install_manifest-tool.sh + - run: tools/install_dive.sh + - run: tools/environment_init.sh + - run: make check_version + + - name: Check if DOCKERHUB_USERNAME exists + run: | + if [[ -z "${{ secrets.DOCKERHUB_USERNAME }}" ]]; then + echo "DOCKERHUB_USERNAME is not set" + exit 1 + else + echo "DOCKERHUB_USERNAME is set" + fi + + - name: Check if DOCKERHUB_ACCESS_TOKEN exists + run: | + if [[ -z "${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" ]]; then + echo "DOCKERHUB_ACCESS_TOKEN is not set" + exit 1 + else + echo "DOCKERHUB_ACCESS_TOKEN is set" + fi + + - name: Login to dockerhub + uses: docker/login-action@v3 + if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} + + - name: Docker Ratelimit Check + # https://docs.docker.com/docker-hub/download-rate-limit/ + run: | + TOKEN=$(curl --user "${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token) + HEADERS=$(curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest) + echo "Rate Limit Info:" + echo "$HEADERS" | grep ratelimit + + - name: Check if image exists + id: check-image + run: | + source tools/environment_init.sh && \ + echo "IMAGE_VERSION_ID=${IMAGE_VERSION_ID}" >> $GITHUB_ENV && \ + if check_image_exists "${{ matrix.version }}-${{ matrix.variant }}${IMAGE_VERSION_ID}"; then + echo "IMAGE_EXISTS=true" >> $GITHUB_ENV + else + echo "IMAGE_EXISTS=false" >> $GITHUB_ENV + fi + + - name: Weekly image exists -> exit + if: env.IMAGE_EXISTS == 'true' + run: | + echo "weekly build exists; no need to re-build. STOP" + exit 0 + + - name: "verify: make -n test-${{ matrix.version }}-${{ matrix.variant }} " + if: env.IMAGE_EXISTS == 'false' + run: make -n test-${{ matrix.version }}-${{ matrix.variant }} + + - name: "make test-${{ matrix.version }}-${{ matrix.variant }} " + if: env.IMAGE_EXISTS == 'false' + run: make test-${{ matrix.version }}-${{ matrix.variant }} + + - name: "make scan-${{ matrix.version }}-${{ matrix.variant }}" + if: env.IMAGE_EXISTS == 'false' + run: make scan-${{ matrix.version }}-${{ matrix.variant }} || true + + - name: "make dive-${{ matrix.version }}-${{ matrix.variant }}" + if: env.IMAGE_EXISTS == 'false' + run: make dive-${{ matrix.version }}-${{ matrix.variant }} || true + + - run: docker images + + - name: Push docker image to dockerhub + if: ${{ (env.IMAGE_EXISTS == 'false') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} + run: | + make push-${{ matrix.version }}-${{ matrix.variant }} + make manifest-${{ matrix.version }}-${{ matrix.variant }} + + make-readme: + name: update readme + needs: make-docker-images + runs-on: ubuntu-22.04 env: - VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }} - VARIANT: ${{ matrix.variant }} + PLATFORM: linux/amd64 + DOCKER_BUILDKIT: '1' + BUILDX_PLATFORMS: linux/amd64 steps: - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Build docker image for ${{ env.VERSION }} ${{ env.VARIANT }} - run: make test + - run: pip3 install --upgrade pip + - run: pip3 install --upgrade lastversion + - run: tools/install_manifest-tool.sh + - run: tools/environment_init.sh + - run: make check_version - name: Login to dockerhub - uses: docker/login-action@v2 + uses: docker/login-action@v3 if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} - - name: Push docker image to dockerhub + - name: Docker Ratelimit Check + # https://docs.docker.com/docker-hub/download-rate-limit/ + run: | + TOKEN=$(curl --user "${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token) + HEADERS=$(curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest) + echo "Rate Limit Info:" + echo "$HEADERS" | grep ratelimit + + - name: push readme to docker hub api if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} env: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} - run: make push - + run: make push-readme diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000..aca5fb60 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,16 @@ +name: "Shellcheck" + +on: + push: + pull_request: + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + env: + SHELLCHECK_OPTS: --external-sources \ No newline at end of file diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 00000000..8bc44af3 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,106 @@ +name: "update_dockerfiles" +# updating the image code and pushing to the local registry +on: + schedule: + - cron: '57 19 * * *' + workflow_dispatch: # Allow manual triggering + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + update_dockerfiles: + name: "update_dockerfiles" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for all branches and tags + + - run: docker ps -a + - name: Login to dockerhub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} + - run: pip3 install --upgrade pip + - run: pip3 install --upgrade lastversion + - run: tools/install_manifest-tool.sh + - run: tools/environment_init.sh + - run: ./update.sh + - run: git status + - run: git diff versions.json + + - name: Check if versions.json changed + id: version_check + run: | + if git diff --name-only | grep 'versions.json'; then + echo "versions_changed=true" >> $GITHUB_ENV + echo "versions_changed=true" + # Generate changed versions list + echo "versions_changed_list=$(./tools/get_versions_changes.sh)" >> $GITHUB_ENV + echo "versions_changed_list=$(./tools/get_versions_changes.sh)" + # Generate branch name with date and time + echo "BRANCH_NAME=updates/$(date +'%Y%m%d_%H%M')" >> $GITHUB_ENV + echo "BRANCH_NAME=updates/$(date +'%Y%m%d_%H%M')" + else + echo "versions.json not changed" + fi + + - name: Check for existing open PRs with label 'automated_pr' + if: env.versions_changed == 'true' + id: check_prs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + existing_prs=$(gh pr list --label automated_pr --json number --jq length) + if [ "$existing_prs" -eq "0" ]; then + echo "create_pr=true" >> $GITHUB_OUTPUT + else + echo "create_pr=false" >> $GITHUB_OUTPUT + echo "An automated PR already exists. Skipping PR creation." + fi + + # https://github.com/peter-evans/create-pull-request + - name: Create Pull Request + if: env.versions_changed == 'true' && steps.check_prs.outputs.create_pr == 'true' + id: create-pr + uses: peter-evans/create-pull-request@v6 + with: + committer: GitHub + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + commit-message: '🤖 Bump versions: ${{ env.versions_changed_list }}' + title: '🤖 Bump versions: ${{ env.versions_changed_list }}' + body: | + ## Automated Version Update + + This pull request was automatically generated by the `update_dockerfiles` workflow ( `.github/workflows/update.yml`) + to update docker-postgis versions.json and related Dockerfiles. + + ### Changes + ${{ env.versions_changed_list }} + + ### Important Notes + 1. **Verification Required**: Please carefully review the changes to ensure they are correct and appropriate. + 2. **PR Limit**: While this PR remains open, no new automated PRs will be created by this workflow. This ensures only one automated update is processed at a time. + + If you have any questions or concerns, please comment on this PR or contact the maintainers. + + labels: automated_pr + branch: ${{ env.BRANCH_NAME }} + delete-branch: true + + - name: Close and Reopen PR + if: steps.create-pr.outputs.pull-request-number + run: | + PR_NUMBER=${{ steps.create-pr.outputs.pull-request-number }} + gh pr close $PR_NUMBER --comment "Closing to trigger full CI/CD pipeline" + sleep 5 # Wait for 5 seconds to ensure the PR is fully closed + gh pr reopen $PR_NUMBER --comment "Reopening to trigger full CI/CD pipeline" + + - name: Comment PR + if: steps.create-pr.outputs.pull-request-number + run: | + PR_NUMBER=${{ steps.create-pr.outputs.pull-request-number }} + gh pr comment $PR_NUMBER --body "This PR was automatically created and reopened by the update_dockerfiles workflow to trigger the full CI/CD pipeline. Please review the changes carefully." + \ No newline at end of file diff --git a/.gitignore b/.gitignore index c4340744..8d160c2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ -_* \ No newline at end of file +.jq-template.awk +.template-helper-functions.jq +_* +.vscode/ +trivy_cache +tmp/ \ No newline at end of file diff --git a/.travis.yml.disabled b/.travis.yml.disabled deleted file mode 100644 index 1415e6fe..00000000 --- a/.travis.yml.disabled +++ /dev/null @@ -1,44 +0,0 @@ ---- -language: bash -services: docker - -dist: xenial - -env: - - VERSION=13-master - - VERSION=13-3.0 - - VERSION=13-3.0 VARIANT=alpine - - VERSION=12-master - - VERSION=12-3.0 - - VERSION=12-3.0 VARIANT=alpine - - VERSION=12-2.5 - - VERSION=12-2.5 VARIANT=alpine - - VERSION=11-3.0 - - VERSION=11-3.0 VARIANT=alpine - - VERSION=11-2.5 - - VERSION=11-2.5 VARIANT=alpine - - VERSION=10-3.0 - - VERSION=10-3.0 VARIANT=alpine - - VERSION=10-2.5 - - VERSION=10-2.5 VARIANT=alpine - - VERSION=9.6-3.0 - - VERSION=9.6-3.0 VARIANT=alpine - - VERSION=9.6-2.5 - - VERSION=9.6-2.5 VARIANT=alpine - - VERSION=9.5-3.0 - - VERSION=9.5-3.0 VARIANT=alpine - - VERSION=9.5-2.5 - - VERSION=9.5-2.5 VARIANT=alpine - -jobs: - allow_failures: - - env: VERSION=12-master - - env: VERSION=13-master - -script: - - if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then - echo "$DOCKERHUB_ACCESS_TOKEN" | docker login -u $DOCKERHUB_USERNAME --password-stdin && - make push ; - else - make test ; - fi diff --git a/13-3.4/alpine/Dockerfile b/12-3.3/alpine3.20/Dockerfile similarity index 68% rename from 13-3.4/alpine/Dockerfile rename to 12-3.3/alpine3.20/Dockerfile index c8445b93..e01034f2 100644 --- a/13-3.4/alpine/Dockerfile +++ b/12-3.3/alpine3.20/Dockerfile @@ -1,34 +1,28 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # -ARG BASE_IMAGE=postgres:13-alpine3.18 -FROM ${BASE_IMAGE} + +ARG PGIS1_BASE_IMAGE=postgres:12-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.3.7 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=a0c796766cbcd369d871283f559fd97a186464dd + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0 spatial database extension with PostgreSQL 13 Alpine" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 12 alpine3.20" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION 3.4.0 -ENV POSTGIS_SHA256 3acdf303adfd58d73543a70e6ebe99af29301262c56cf32220d42caa3efab024 - RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ && apk add --no-cache --virtual .build-deps \ \ + ca-certificates \ gdal-dev \ geos-dev \ proj-dev \ @@ -42,6 +36,7 @@ RUN set -eux \ \ autoconf \ automake \ + bison \ cunit-dev \ file \ g++ \ @@ -51,11 +46,26 @@ RUN set -eux \ json-c-dev \ libtool \ libxml2-dev \ + libxml2-utils \ make \ - pcre2-dev \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ perl \ protobuf-c-dev \ \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ # build PostGIS - with Link Time Optimization (LTO) enabled && cd /usr/src/postgis \ && gettextize \ @@ -78,7 +88,7 @@ RUN set -eux \ && su postgres -c 'pg_ctl -D /tempdb init' \ && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ @@ -106,16 +116,22 @@ RUN set -eux \ \ json-c \ libstdc++ \ - pcre2 \ + pcre \ protobuf-c \ \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ # ca-certificates: for accessing remote raster files # fix https://github.com/postgis/docker-postgis/issues/307 ca-certificates \ # clean && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ # At the end of the build, we print the collected information # from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. && cat /_pgis_full_version.txt diff --git a/12-3.4/initdb-postgis.sh b/12-3.3/alpine3.20/initdb-postgis.sh similarity index 81% rename from 12-3.4/initdb-postgis.sh rename to 12-3.3/alpine3.20/initdb-postgis.sh index e38ad7d6..21f8c373 100644 --- a/12-3.4/initdb-postgis.sh +++ b/12-3.3/alpine3.20/initdb-postgis.sh @@ -1,19 +1,19 @@ #!/bin/bash - +# shellcheck disable=SC2154 set -e # Perform all actions as $POSTGRES_USER export PGUSER="$POSTGRES_USER" # Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' +"${psql[@]}" <<-'EOSQL' CREATE DATABASE template_postgis IS_TEMPLATE true; EOSQL # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS postgis_topology; -- Reconnect to update pg_setting.resetval diff --git a/12-3.3/alpine3.20/tags b/12-3.3/alpine3.20/tags new file mode 100644 index 00000000..7eb40ee5 --- /dev/null +++ b/12-3.3/alpine3.20/tags @@ -0,0 +1 @@ +12-3.3-alpine3.20 12-3.3.7-alpine3.20 12-3.3-alpine diff --git a/11-3.3/alpine/update-postgis.sh b/12-3.3/alpine3.20/update-postgis.sh similarity index 100% rename from 11-3.3/alpine/update-postgis.sh rename to 12-3.3/alpine3.20/update-postgis.sh diff --git a/14-3.4/alpine/Dockerfile b/12-3.4/alpine3.19/Dockerfile similarity index 68% rename from 14-3.4/alpine/Dockerfile rename to 12-3.4/alpine3.19/Dockerfile index ed36cfca..ae2edca0 100644 --- a/14-3.4/alpine/Dockerfile +++ b/12-3.4/alpine3.19/Dockerfile @@ -1,34 +1,28 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # -ARG BASE_IMAGE=postgres:14-alpine3.18 -FROM ${BASE_IMAGE} + +ARG PGIS1_BASE_IMAGE=postgres:12-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0 spatial database extension with PostgreSQL 14 Alpine" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 12 alpine3.19" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION 3.4.0 -ENV POSTGIS_SHA256 3acdf303adfd58d73543a70e6ebe99af29301262c56cf32220d42caa3efab024 - RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ && apk add --no-cache --virtual .build-deps \ \ + ca-certificates \ gdal-dev \ geos-dev \ proj-dev \ @@ -42,6 +36,7 @@ RUN set -eux \ \ autoconf \ automake \ + bison \ cunit-dev \ file \ g++ \ @@ -51,11 +46,26 @@ RUN set -eux \ json-c-dev \ libtool \ libxml2-dev \ + libxml2-utils \ make \ - pcre2-dev \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ perl \ protobuf-c-dev \ \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ # build PostGIS - with Link Time Optimization (LTO) enabled && cd /usr/src/postgis \ && gettextize \ @@ -78,7 +88,7 @@ RUN set -eux \ && su postgres -c 'pg_ctl -D /tempdb init' \ && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ @@ -106,16 +116,22 @@ RUN set -eux \ \ json-c \ libstdc++ \ - pcre2 \ + pcre \ protobuf-c \ \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ # ca-certificates: for accessing remote raster files # fix https://github.com/postgis/docker-postgis/issues/307 ca-certificates \ # clean && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ # At the end of the build, we print the collected information # from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. && cat /_pgis_full_version.txt diff --git a/12-3.4/alpine/initdb-postgis.sh b/12-3.4/alpine3.19/initdb-postgis.sh similarity index 81% rename from 12-3.4/alpine/initdb-postgis.sh rename to 12-3.4/alpine3.19/initdb-postgis.sh index e38ad7d6..21f8c373 100644 --- a/12-3.4/alpine/initdb-postgis.sh +++ b/12-3.4/alpine3.19/initdb-postgis.sh @@ -1,19 +1,19 @@ #!/bin/bash - +# shellcheck disable=SC2154 set -e # Perform all actions as $POSTGRES_USER export PGUSER="$POSTGRES_USER" # Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' +"${psql[@]}" <<-'EOSQL' CREATE DATABASE template_postgis IS_TEMPLATE true; EOSQL # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS postgis_topology; -- Reconnect to update pg_setting.resetval diff --git a/12-3.4/alpine3.19/tags b/12-3.4/alpine3.19/tags new file mode 100644 index 00000000..d18b20ca --- /dev/null +++ b/12-3.4/alpine3.19/tags @@ -0,0 +1 @@ +12-3.4-alpine3.19 12-3.4.3-alpine3.19 diff --git a/11-3.3/update-postgis.sh b/12-3.4/alpine3.19/update-postgis.sh similarity index 100% rename from 11-3.3/update-postgis.sh rename to 12-3.4/alpine3.19/update-postgis.sh diff --git a/11-3.3/alpine/Dockerfile b/12-3.4/alpine3.20/Dockerfile similarity index 68% rename from 11-3.3/alpine/Dockerfile rename to 12-3.4/alpine3.20/Dockerfile index 86b94165..a2ca0ee0 100644 --- a/11-3.3/alpine/Dockerfile +++ b/12-3.4/alpine3.20/Dockerfile @@ -1,34 +1,28 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # -ARG BASE_IMAGE=postgres:11-alpine3.18 -FROM ${BASE_IMAGE} + +ARG PGIS1_BASE_IMAGE=postgres:12-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.3.4 spatial database extension with PostgreSQL 11 Alpine" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 12 alpine3.20" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION 3.3.4 -ENV POSTGIS_SHA256 68507aa4ab7f9f7218fcefdcdd989911415e5f670128eb33acbbb362a24a998e - RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ && apk add --no-cache --virtual .build-deps \ \ + ca-certificates \ gdal-dev \ geos-dev \ proj-dev \ @@ -42,6 +36,7 @@ RUN set -eux \ \ autoconf \ automake \ + bison \ cunit-dev \ file \ g++ \ @@ -51,11 +46,26 @@ RUN set -eux \ json-c-dev \ libtool \ libxml2-dev \ + libxml2-utils \ make \ - pcre2-dev \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ perl \ protobuf-c-dev \ \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ # build PostGIS - with Link Time Optimization (LTO) enabled && cd /usr/src/postgis \ && gettextize \ @@ -78,7 +88,7 @@ RUN set -eux \ && su postgres -c 'pg_ctl -D /tempdb init' \ && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ @@ -106,16 +116,22 @@ RUN set -eux \ \ json-c \ libstdc++ \ - pcre2 \ + pcre \ protobuf-c \ \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ # ca-certificates: for accessing remote raster files # fix https://github.com/postgis/docker-postgis/issues/307 ca-certificates \ # clean && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ # At the end of the build, we print the collected information # from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. && cat /_pgis_full_version.txt diff --git a/11-3.3/initdb-postgis.sh b/12-3.4/alpine3.20/initdb-postgis.sh similarity index 81% rename from 11-3.3/initdb-postgis.sh rename to 12-3.4/alpine3.20/initdb-postgis.sh index e38ad7d6..21f8c373 100644 --- a/11-3.3/initdb-postgis.sh +++ b/12-3.4/alpine3.20/initdb-postgis.sh @@ -1,19 +1,19 @@ #!/bin/bash - +# shellcheck disable=SC2154 set -e # Perform all actions as $POSTGRES_USER export PGUSER="$POSTGRES_USER" # Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' +"${psql[@]}" <<-'EOSQL' CREATE DATABASE template_postgis IS_TEMPLATE true; EOSQL # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS postgis_topology; -- Reconnect to update pg_setting.resetval diff --git a/12-3.4/alpine3.20/tags b/12-3.4/alpine3.20/tags new file mode 100644 index 00000000..0dfba80e --- /dev/null +++ b/12-3.4/alpine3.20/tags @@ -0,0 +1 @@ +12-3.4-alpine3.20 12-3.4.3-alpine3.20 12-3.4-alpine diff --git a/12-3.4/alpine/update-postgis.sh b/12-3.4/alpine3.20/update-postgis.sh similarity index 100% rename from 12-3.4/alpine/update-postgis.sh rename to 12-3.4/alpine3.20/update-postgis.sh diff --git a/12-3.4/alpine/Dockerfile b/12-3.5/alpine3.19/Dockerfile similarity index 68% rename from 12-3.4/alpine/Dockerfile rename to 12-3.5/alpine3.19/Dockerfile index 9b0ce6aa..c7df6bf3 100644 --- a/12-3.4/alpine/Dockerfile +++ b/12-3.5/alpine3.19/Dockerfile @@ -1,34 +1,28 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # -ARG BASE_IMAGE=postgres:12-alpine3.18 -FROM ${BASE_IMAGE} + +ARG PGIS1_BASE_IMAGE=postgres:12-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0 spatial database extension with PostgreSQL 12 Alpine" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 12 alpine3.19" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION 3.4.0 -ENV POSTGIS_SHA256 3acdf303adfd58d73543a70e6ebe99af29301262c56cf32220d42caa3efab024 - RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ && apk add --no-cache --virtual .build-deps \ \ + ca-certificates \ gdal-dev \ geos-dev \ proj-dev \ @@ -42,6 +36,7 @@ RUN set -eux \ \ autoconf \ automake \ + bison \ cunit-dev \ file \ g++ \ @@ -51,11 +46,26 @@ RUN set -eux \ json-c-dev \ libtool \ libxml2-dev \ + libxml2-utils \ make \ - pcre2-dev \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ perl \ protobuf-c-dev \ \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ # build PostGIS - with Link Time Optimization (LTO) enabled && cd /usr/src/postgis \ && gettextize \ @@ -78,7 +88,7 @@ RUN set -eux \ && su postgres -c 'pg_ctl -D /tempdb init' \ && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ @@ -106,16 +116,22 @@ RUN set -eux \ \ json-c \ libstdc++ \ - pcre2 \ + pcre \ protobuf-c \ \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ # ca-certificates: for accessing remote raster files # fix https://github.com/postgis/docker-postgis/issues/307 ca-certificates \ # clean && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ # At the end of the build, we print the collected information # from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. && cat /_pgis_full_version.txt diff --git a/11-3.3/alpine/initdb-postgis.sh b/12-3.5/alpine3.19/initdb-postgis.sh similarity index 81% rename from 11-3.3/alpine/initdb-postgis.sh rename to 12-3.5/alpine3.19/initdb-postgis.sh index e38ad7d6..21f8c373 100644 --- a/11-3.3/alpine/initdb-postgis.sh +++ b/12-3.5/alpine3.19/initdb-postgis.sh @@ -1,19 +1,19 @@ #!/bin/bash - +# shellcheck disable=SC2154 set -e # Perform all actions as $POSTGRES_USER export PGUSER="$POSTGRES_USER" # Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' +"${psql[@]}" <<-'EOSQL' CREATE DATABASE template_postgis IS_TEMPLATE true; EOSQL # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS postgis_topology; -- Reconnect to update pg_setting.resetval diff --git a/12-3.5/alpine3.19/tags b/12-3.5/alpine3.19/tags new file mode 100644 index 00000000..25d7c1e1 --- /dev/null +++ b/12-3.5/alpine3.19/tags @@ -0,0 +1 @@ +12-3.5-alpine3.19 12-3.5.0-alpine3.19 diff --git a/12-3.4/update-postgis.sh b/12-3.5/alpine3.19/update-postgis.sh similarity index 100% rename from 12-3.4/update-postgis.sh rename to 12-3.5/alpine3.19/update-postgis.sh diff --git a/12-3.5/alpine3.20/Dockerfile b/12-3.5/alpine3.20/Dockerfile new file mode 100644 index 00000000..a018bd00 --- /dev/null +++ b/12-3.5/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:12-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 12 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/12-3.5/alpine3.20/initdb-postgis.sh b/12-3.5/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/12-3.5/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/12-3.5/alpine3.20/tags b/12-3.5/alpine3.20/tags new file mode 100644 index 00000000..799eed3e --- /dev/null +++ b/12-3.5/alpine3.20/tags @@ -0,0 +1 @@ +12-3.5-alpine3.20 12-3.5.0-alpine3.20 12-3.5-alpine diff --git a/13-3.4/alpine/update-postgis.sh b/12-3.5/alpine3.20/update-postgis.sh similarity index 100% rename from 13-3.4/alpine/update-postgis.sh rename to 12-3.5/alpine3.20/update-postgis.sh diff --git a/12-3.5/bookworm/Dockerfile b/12-3.5/bookworm/Dockerfile new file mode 100644 index 00000000..83c6b6dd --- /dev/null +++ b/12-3.5/bookworm/Dockerfile @@ -0,0 +1,39 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM postgres:12-bookworm + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg120+1 spatial database extension with PostgreSQL 12 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ENV POSTGIS_MAJOR 3 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg120+1 + +RUN set -eux \ + && apt-get update \ + && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ + && apt-get install -y --no-install-recommends \ + # ca-certificates: for accessing remote raster files; + # fix: https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ + \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ + && rm -rf /var/lib/apt/lists/* + +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/12-3.5/bookworm/initdb-postgis.sh b/12-3.5/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/12-3.5/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/12-3.5/bookworm/tags b/12-3.5/bookworm/tags new file mode 100644 index 00000000..7fc29cf7 --- /dev/null +++ b/12-3.5/bookworm/tags @@ -0,0 +1 @@ +12-3.5-bookworm 12-3.5.0-bookworm 12-3.5 diff --git a/13-3.4/update-postgis.sh b/12-3.5/bookworm/update-postgis.sh similarity index 100% rename from 13-3.4/update-postgis.sh rename to 12-3.5/bookworm/update-postgis.sh diff --git a/12-3.4/Dockerfile b/12-3.5/bullseye/Dockerfile similarity index 60% rename from 12-3.4/Dockerfile rename to 12-3.5/bullseye/Dockerfile index b85e4fde..c652c85f 100644 --- a/12-3.4/Dockerfile +++ b/12-3.5/bullseye/Dockerfile @@ -1,17 +1,19 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # - FROM postgres:12-bullseye LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 12 bullseye" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 12 bullseye" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR 3 -ENV POSTGIS_VERSION 3.4.0+dfsg-1.pgdg110+1 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1 -RUN apt-get update \ +RUN set -eux \ + && apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; @@ -20,9 +22,18 @@ RUN apt-get update \ \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ && rm -rf /var/lib/apt/lists/* +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + RUN mkdir -p /docker-entrypoint-initdb.d COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh COPY ./update-postgis.sh /usr/local/bin - diff --git a/12-3.5/bullseye/initdb-postgis.sh b/12-3.5/bullseye/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/12-3.5/bullseye/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/12-3.5/bullseye/tags b/12-3.5/bullseye/tags new file mode 100644 index 00000000..9edbdd7d --- /dev/null +++ b/12-3.5/bullseye/tags @@ -0,0 +1 @@ +12-3.5-bullseye 12-3.5.0-bullseye diff --git a/14-3.4/alpine/update-postgis.sh b/12-3.5/bullseye/update-postgis.sh similarity index 100% rename from 14-3.4/alpine/update-postgis.sh rename to 12-3.5/bullseye/update-postgis.sh diff --git a/13-3.3/alpine3.20/Dockerfile b/13-3.3/alpine3.20/Dockerfile new file mode 100644 index 00000000..6a9c61d1 --- /dev/null +++ b/13-3.3/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:13-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.3.7 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=a0c796766cbcd369d871283f559fd97a186464dd + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 13 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/13-3.3/alpine3.20/initdb-postgis.sh b/13-3.3/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/13-3.3/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/13-3.3/alpine3.20/tags b/13-3.3/alpine3.20/tags new file mode 100644 index 00000000..6a58d94e --- /dev/null +++ b/13-3.3/alpine3.20/tags @@ -0,0 +1 @@ +13-3.3-alpine3.20 13-3.3.7-alpine3.20 13-3.3-alpine diff --git a/14-3.4/update-postgis.sh b/13-3.3/alpine3.20/update-postgis.sh similarity index 100% rename from 14-3.4/update-postgis.sh rename to 13-3.3/alpine3.20/update-postgis.sh diff --git a/13-3.4/alpine/initdb-postgis.sh b/13-3.4/alpine/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/13-3.4/alpine/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/13-3.4/alpine3.19/Dockerfile b/13-3.4/alpine3.19/Dockerfile new file mode 100644 index 00000000..c8ac8cdc --- /dev/null +++ b/13-3.4/alpine3.19/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:13-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 13 alpine3.19" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/13-3.4/alpine3.19/initdb-postgis.sh b/13-3.4/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/13-3.4/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/13-3.4/alpine3.19/tags b/13-3.4/alpine3.19/tags new file mode 100644 index 00000000..d455e2cf --- /dev/null +++ b/13-3.4/alpine3.19/tags @@ -0,0 +1 @@ +13-3.4-alpine3.19 13-3.4.3-alpine3.19 diff --git a/15-3.4/alpine/update-postgis.sh b/13-3.4/alpine3.19/update-postgis.sh similarity index 100% rename from 15-3.4/alpine/update-postgis.sh rename to 13-3.4/alpine3.19/update-postgis.sh diff --git a/13-3.4/alpine3.20/Dockerfile b/13-3.4/alpine3.20/Dockerfile new file mode 100644 index 00000000..52dc445f --- /dev/null +++ b/13-3.4/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:13-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 13 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/13-3.4/alpine3.20/initdb-postgis.sh b/13-3.4/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/13-3.4/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/13-3.4/alpine3.20/tags b/13-3.4/alpine3.20/tags new file mode 100644 index 00000000..fc62a43e --- /dev/null +++ b/13-3.4/alpine3.20/tags @@ -0,0 +1 @@ +13-3.4-alpine3.20 13-3.4.3-alpine3.20 13-3.4-alpine diff --git a/15-3.4/update-postgis.sh b/13-3.4/alpine3.20/update-postgis.sh similarity index 100% rename from 15-3.4/update-postgis.sh rename to 13-3.4/alpine3.20/update-postgis.sh diff --git a/13-3.4/initdb-postgis.sh b/13-3.4/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/13-3.4/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/13-3.5/alpine3.19/Dockerfile b/13-3.5/alpine3.19/Dockerfile new file mode 100644 index 00000000..fed4b017 --- /dev/null +++ b/13-3.5/alpine3.19/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:13-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 13 alpine3.19" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/13-3.5/alpine3.19/initdb-postgis.sh b/13-3.5/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/13-3.5/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/13-3.5/alpine3.19/tags b/13-3.5/alpine3.19/tags new file mode 100644 index 00000000..2604f04b --- /dev/null +++ b/13-3.5/alpine3.19/tags @@ -0,0 +1 @@ +13-3.5-alpine3.19 13-3.5.0-alpine3.19 diff --git a/15-master/update-postgis.sh b/13-3.5/alpine3.19/update-postgis.sh similarity index 100% rename from 15-master/update-postgis.sh rename to 13-3.5/alpine3.19/update-postgis.sh diff --git a/13-3.5/alpine3.20/Dockerfile b/13-3.5/alpine3.20/Dockerfile new file mode 100644 index 00000000..865b6ee6 --- /dev/null +++ b/13-3.5/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:13-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 13 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/13-3.5/alpine3.20/initdb-postgis.sh b/13-3.5/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/13-3.5/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/13-3.5/alpine3.20/tags b/13-3.5/alpine3.20/tags new file mode 100644 index 00000000..2906c5c5 --- /dev/null +++ b/13-3.5/alpine3.20/tags @@ -0,0 +1 @@ +13-3.5-alpine3.20 13-3.5.0-alpine3.20 13-3.5-alpine diff --git a/16-3.4/alpine/update-postgis.sh b/13-3.5/alpine3.20/update-postgis.sh similarity index 100% rename from 16-3.4/alpine/update-postgis.sh rename to 13-3.5/alpine3.20/update-postgis.sh diff --git a/13-3.5/bookworm/Dockerfile b/13-3.5/bookworm/Dockerfile new file mode 100644 index 00000000..e6335a01 --- /dev/null +++ b/13-3.5/bookworm/Dockerfile @@ -0,0 +1,39 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM postgres:13-bookworm + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg120+1 spatial database extension with PostgreSQL 13 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ENV POSTGIS_MAJOR 3 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg120+1 + +RUN set -eux \ + && apt-get update \ + && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ + && apt-get install -y --no-install-recommends \ + # ca-certificates: for accessing remote raster files; + # fix: https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ + \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ + && rm -rf /var/lib/apt/lists/* + +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/13-3.5/bookworm/initdb-postgis.sh b/13-3.5/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/13-3.5/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/13-3.5/bookworm/tags b/13-3.5/bookworm/tags new file mode 100644 index 00000000..1b2c9eb4 --- /dev/null +++ b/13-3.5/bookworm/tags @@ -0,0 +1 @@ +13-3.5-bookworm 13-3.5.0-bookworm 13-3.5 diff --git a/16-3.4/update-postgis.sh b/13-3.5/bookworm/update-postgis.sh similarity index 100% rename from 16-3.4/update-postgis.sh rename to 13-3.5/bookworm/update-postgis.sh diff --git a/13-3.4/Dockerfile b/13-3.5/bullseye/Dockerfile similarity index 60% rename from 13-3.4/Dockerfile rename to 13-3.5/bullseye/Dockerfile index b20c0d9f..efe79d47 100644 --- a/13-3.4/Dockerfile +++ b/13-3.5/bullseye/Dockerfile @@ -1,17 +1,19 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # - FROM postgres:13-bullseye LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 13 bullseye" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 13 bullseye" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR 3 -ENV POSTGIS_VERSION 3.4.0+dfsg-1.pgdg110+1 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1 -RUN apt-get update \ +RUN set -eux \ + && apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; @@ -20,9 +22,18 @@ RUN apt-get update \ \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ && rm -rf /var/lib/apt/lists/* +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + RUN mkdir -p /docker-entrypoint-initdb.d COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh COPY ./update-postgis.sh /usr/local/bin - diff --git a/13-3.5/bullseye/initdb-postgis.sh b/13-3.5/bullseye/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/13-3.5/bullseye/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/13-3.5/bullseye/tags b/13-3.5/bullseye/tags new file mode 100644 index 00000000..f59017c1 --- /dev/null +++ b/13-3.5/bullseye/tags @@ -0,0 +1 @@ +13-3.5-bullseye 13-3.5.0-bullseye diff --git a/16-master/update-postgis.sh b/13-3.5/bullseye/update-postgis.sh similarity index 100% rename from 16-master/update-postgis.sh rename to 13-3.5/bullseye/update-postgis.sh diff --git a/14-3.3/alpine3.20/Dockerfile b/14-3.3/alpine3.20/Dockerfile new file mode 100644 index 00000000..c5a4ddbb --- /dev/null +++ b/14-3.3/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:14-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.3.7 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=a0c796766cbcd369d871283f559fd97a186464dd + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 14 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/14-3.3/alpine3.20/initdb-postgis.sh b/14-3.3/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/14-3.3/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/14-3.3/alpine3.20/tags b/14-3.3/alpine3.20/tags new file mode 100644 index 00000000..6347df27 --- /dev/null +++ b/14-3.3/alpine3.20/tags @@ -0,0 +1 @@ +14-3.3-alpine3.20 14-3.3.7-alpine3.20 14-3.3-alpine diff --git a/14-3.3/alpine3.20/update-postgis.sh b/14-3.3/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/14-3.3/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/14-3.4/alpine/initdb-postgis.sh b/14-3.4/alpine/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/14-3.4/alpine/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/14-3.4/alpine3.19/Dockerfile b/14-3.4/alpine3.19/Dockerfile new file mode 100644 index 00000000..8ac8c3bd --- /dev/null +++ b/14-3.4/alpine3.19/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:14-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 14 alpine3.19" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/14-3.4/alpine3.19/initdb-postgis.sh b/14-3.4/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/14-3.4/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/14-3.4/alpine3.19/tags b/14-3.4/alpine3.19/tags new file mode 100644 index 00000000..76999930 --- /dev/null +++ b/14-3.4/alpine3.19/tags @@ -0,0 +1 @@ +14-3.4-alpine3.19 14-3.4.3-alpine3.19 diff --git a/14-3.4/alpine3.19/update-postgis.sh b/14-3.4/alpine3.19/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/14-3.4/alpine3.19/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/14-3.4/alpine3.20/Dockerfile b/14-3.4/alpine3.20/Dockerfile new file mode 100644 index 00000000..c8629edb --- /dev/null +++ b/14-3.4/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:14-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 14 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/14-3.4/alpine3.20/initdb-postgis.sh b/14-3.4/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/14-3.4/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/14-3.4/alpine3.20/tags b/14-3.4/alpine3.20/tags new file mode 100644 index 00000000..3a70b758 --- /dev/null +++ b/14-3.4/alpine3.20/tags @@ -0,0 +1 @@ +14-3.4-alpine3.20 14-3.4.3-alpine3.20 14-3.4-alpine diff --git a/14-3.4/alpine3.20/update-postgis.sh b/14-3.4/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/14-3.4/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/14-3.4/initdb-postgis.sh b/14-3.4/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/14-3.4/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/14-3.5/alpine3.19/Dockerfile b/14-3.5/alpine3.19/Dockerfile new file mode 100644 index 00000000..75592a90 --- /dev/null +++ b/14-3.5/alpine3.19/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:14-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 14 alpine3.19" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/14-3.5/alpine3.19/initdb-postgis.sh b/14-3.5/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/14-3.5/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/14-3.5/alpine3.19/tags b/14-3.5/alpine3.19/tags new file mode 100644 index 00000000..268dcff1 --- /dev/null +++ b/14-3.5/alpine3.19/tags @@ -0,0 +1 @@ +14-3.5-alpine3.19 14-3.5.0-alpine3.19 diff --git a/14-3.5/alpine3.19/update-postgis.sh b/14-3.5/alpine3.19/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/14-3.5/alpine3.19/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/14-3.5/alpine3.20/Dockerfile b/14-3.5/alpine3.20/Dockerfile new file mode 100644 index 00000000..a82afcd5 --- /dev/null +++ b/14-3.5/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:14-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 14 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/14-3.5/alpine3.20/initdb-postgis.sh b/14-3.5/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/14-3.5/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/14-3.5/alpine3.20/tags b/14-3.5/alpine3.20/tags new file mode 100644 index 00000000..17ff6924 --- /dev/null +++ b/14-3.5/alpine3.20/tags @@ -0,0 +1 @@ +14-3.5-alpine3.20 14-3.5.0-alpine3.20 14-3.5-alpine diff --git a/14-3.5/alpine3.20/update-postgis.sh b/14-3.5/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/14-3.5/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/14-3.5/bookworm/Dockerfile b/14-3.5/bookworm/Dockerfile new file mode 100644 index 00000000..c0d806ac --- /dev/null +++ b/14-3.5/bookworm/Dockerfile @@ -0,0 +1,39 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM postgres:14-bookworm + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg120+1 spatial database extension with PostgreSQL 14 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ENV POSTGIS_MAJOR 3 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg120+1 + +RUN set -eux \ + && apt-get update \ + && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ + && apt-get install -y --no-install-recommends \ + # ca-certificates: for accessing remote raster files; + # fix: https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ + \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ + && rm -rf /var/lib/apt/lists/* + +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/14-3.5/bookworm/initdb-postgis.sh b/14-3.5/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/14-3.5/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/14-3.5/bookworm/tags b/14-3.5/bookworm/tags new file mode 100644 index 00000000..f4a5e22f --- /dev/null +++ b/14-3.5/bookworm/tags @@ -0,0 +1 @@ +14-3.5-bookworm 14-3.5.0-bookworm 14-3.5 diff --git a/14-3.5/bookworm/update-postgis.sh b/14-3.5/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/14-3.5/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/14-3.4/Dockerfile b/14-3.5/bullseye/Dockerfile similarity index 60% rename from 14-3.4/Dockerfile rename to 14-3.5/bullseye/Dockerfile index 36d79b7f..4a4e82d7 100644 --- a/14-3.4/Dockerfile +++ b/14-3.5/bullseye/Dockerfile @@ -1,17 +1,19 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # - FROM postgres:14-bullseye LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 14 bullseye" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 14 bullseye" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR 3 -ENV POSTGIS_VERSION 3.4.0+dfsg-1.pgdg110+1 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1 -RUN apt-get update \ +RUN set -eux \ + && apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; @@ -20,9 +22,18 @@ RUN apt-get update \ \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ && rm -rf /var/lib/apt/lists/* +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + RUN mkdir -p /docker-entrypoint-initdb.d COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh COPY ./update-postgis.sh /usr/local/bin - diff --git a/14-3.5/bullseye/initdb-postgis.sh b/14-3.5/bullseye/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/14-3.5/bullseye/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/14-3.5/bullseye/tags b/14-3.5/bullseye/tags new file mode 100644 index 00000000..9011cd43 --- /dev/null +++ b/14-3.5/bullseye/tags @@ -0,0 +1 @@ +14-3.5-bullseye 14-3.5.0-bullseye diff --git a/14-3.5/bullseye/update-postgis.sh b/14-3.5/bullseye/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/14-3.5/bullseye/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/14-l3.1.9gcp/bookworm/Dockerfile b/14-l3.1.9gcp/bookworm/Dockerfile new file mode 100644 index 00000000..46b4663a --- /dev/null +++ b/14-l3.1.9gcp/bookworm/Dockerfile @@ -0,0 +1,634 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.master.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +# "Experimental"; solely for testing purposes. Anticipate frequent changes! +# This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05. + +ARG PGIS1_BASE_IMAGE=postgres:14-bookworm + +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_GEOS_REPOSITORY=https://github.com/libgeos/geos.git +ARG PGIS1_GDAL_REPOSITORY=https://github.com/OSGeo/gdal.git +ARG PGIS1_PROJ_REPOSITORY=https://github.com/OSGeo/PROJ.git +ARG PGIS1_SFCGAL_REPOSITORY=https://gitlab.com/sfcgal/SFCGAL.git +ARG PGIS1_CGAL_REPOSITORY=https://github.com/CGAL/cgal.git + +# Should valid git checkout ( SHA1, tags, branches ) +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.1.9 +ARG PGIS1_GEOS_CHECKOUT=tags/3.6.6 +ARG PGIS1_GDAL_CHECKOUT=tags/v3.6.4 +ARG PGIS1_PROJ_CHECKOUT=tags/6.3.1 +ARG PGIS1_SFCGAL_CHECKOUT=tags/v1.5.1 +ARG PGIS1_CGAL_CHECKOUT=tags/v5.6 + +# Skip SHA1 check if PGIS1_*_CHECKOUT_SHA1 is empty or 'nocheck' +# Otherwise, verify that the commit hash matches +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=95a641b1747721d7004c5f0133b918d034035319 +ARG PGIS1_GEOS_CHECKOUT_SHA1=36ea3034fb8719a639a7e7727e54ec8ab2e8a196 +ARG PGIS1_GDAL_CHECKOUT_SHA1=7ca88116f5a46d429251361634eb24629f315076 +ARG PGIS1_PROJ_CHECKOUT_SHA1=0e993d9744ecaa2f146bf62c43aecc61809a43ef +ARG PGIS1_SFCGAL_CHECKOUT_SHA1=61f3b08ade49493b56c6bafa98c7c1f84addbc10 +ARG PGIS1_CGAL_CHECKOUT_SHA1=de4fa0d7d57b5a997012f2804161386ff4bc0d0f + +ARG PGIS1_BOOST_VERSION=1.74.0 +ARG PGIS1_CMAKE_BUILD_TYPE=Release + +ARG PGIS1_GDAL_BUILD=minimal +# Minimal GDAL build ; no arrow, no parquet, no extra dependencies + +FROM ${PGIS1_BASE_IMAGE} as builder + +WORKDIR / + +ARG PGIS1_BOOST_VERSION +ENV PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +# apt-get install +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + # build dependency + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libpq-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + make \ + pkg-config \ + protobuf-c-compiler \ + xsltproc \ + # gdal+ + liblz4-dev \ + liblzma-dev \ + libwebp-dev \ + libzstd-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ARG PGIS1_CMAKE_BUILD_TYPE +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} + +FROM builder as cgal-sfcgal-builder + +# cgal & sfcgal +ARG PGIS1_SFCGAL_REPOSITORY +ENV PGIS1_SFCGAL_REPOSITORY ${PGIS1_SFCGAL_REPOSITORY} +ARG PGIS1_SFCGAL_CHECKOUT +ENV PGIS1_SFCGAL_CHECKOUT ${PGIS1_SFCGAL_CHECKOUT} +ARG PGIS1_SFCGAL_CHECKOUT_SHA1 + +ARG PGIS1_CGAL_REPOSITORY +ENV PGIS1_CGAL_REPOSITORY ${PGIS1_CGAL_REPOSITORY} +ARG PGIS1_CGAL_CHECKOUT +ENV PGIS1_CGAL_CHECKOUT ${PGIS1_CGAL_CHECKOUT} +ARG PGIS1_CGAL_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir cgal \ + && cd cgal \ + && git init \ + && git remote add origin ${PGIS1_CGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_CGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_CGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_CGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_CGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_CGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping CGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_CGAL_CHECKOUT_SHA1}" ]; then \ + echo "CGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_cgal_last_commit.txt \ + && cd /usr/src \ + && mkdir SFCGAL \ + && cd SFCGAL \ + && git init \ + && git remote add origin ${PGIS1_SFCGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_SFCGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_SFCGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_SFCGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_SFCGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping SFCGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ]; then \ + echo "SFCGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_sfcgal_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. \ + -DCGAL_DIR=/usr/src/cgal \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DSFCGAL_BUILD_BENCH=OFF \ + -DSFCGAL_BUILD_EXAMPLES=OFF \ + -DSFCGAL_BUILD_TESTS=OFF \ + -DSFCGAL_WITH_OSG=OFF \ + && make -j$(nproc) \ + && make install \ + # clean + && rm -fr /usr/src/SFCGAL \ + && rm -fr /usr/src/cgal + + +FROM builder as proj-builder + +# proj +ARG PGIS1_PROJ_REPOSITORY +ENV PGIS1_PROJ_REPOSITORY ${PGIS1_PROJ_REPOSITORY} +ARG PGIS1_PROJ_CHECKOUT +ENV PGIS1_PROJ_CHECKOUT ${PGIS1_PROJ_CHECKOUT} +ARG PGIS1_PROJ_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir PROJ \ + && cd PROJ \ + && git init \ + && git remote add origin ${PGIS1_PROJ_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PROJ_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_PROJ_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_PROJ_CHECKOUT_SHA1 + && if [ -z "${PGIS1_PROJ_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_PROJ_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping PROJ SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_PROJ_CHECKOUT_SHA1}" ]; then \ + echo "PROJ SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_proj_last_commit.txt \ + # check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027 + && if [ -f "autogen.sh" ] ; then \ + set -eux \ + && echo "autotools version: 'autogen.sh' exists! Older version!" \ + && ./autogen.sh \ + && ./configure --disable-static \ + && make -j$(nproc) \ + && make install \ + ; \ + else \ + set -eux \ + && echo "cmake version: 'autogen.sh' does not exists! Newer version!" \ + && mkdir build \ + && cd build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + ; \ + fi \ + \ + && rm -fr /usr/src/PROJ + + +FROM builder as geos-builder + +# geos +ARG PGIS1_GEOS_REPOSITORY +ENV PGIS1_GEOS_REPOSITORY ${PGIS1_GEOS_REPOSITORY} +ARG PGIS1_GEOS_CHECKOUT +ENV PGIS1_GEOS_CHECKOUT ${PGIS1_GEOS_CHECKOUT} +ARG PGIS1_GEOS_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir geos \ + && cd geos \ + && git init \ + && git remote add origin ${PGIS1_GEOS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GEOS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GEOS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GEOS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GEOS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GEOS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GEOS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GEOS_CHECKOUT_SHA1}" ]; then \ + echo "GEOS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_geos_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/geos + + +FROM builder as stage0-builder + +COPY --from=cgal-sfcgal-builder /_pgis*.* / +COPY --from=cgal-sfcgal-builder /usr/local /usr/local + +COPY --from=proj-builder /_pgis*.* / +COPY --from=proj-builder /usr/local /usr/local + +COPY --from=geos-builder /_pgis*.* / +COPY --from=geos-builder /usr/local /usr/local +# gdal +ARG PGIS1_GDAL_REPOSITORY +ENV PGIS1_GDAL_REPOSITORY ${PGIS1_GDAL_REPOSITORY} +ARG PGIS1_GDAL_CHECKOUT +ENV PGIS1_GDAL_CHECKOUT ${PGIS1_GDAL_CHECKOUT} +ARG PGIS1_GDAL_CHECKOUT_SHA1 + + +# + +## GDAL_build-end + +RUN set -eux \ + && ldconfig \ + && cd /usr/src \ + && mkdir gdal \ + && cd gdal \ + && git init \ + && git remote add origin ${PGIS1_GDAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GDAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GDAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GDAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GDAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GDAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GDAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GDAL_CHECKOUT_SHA1}" ]; then \ + echo "GDAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_gdal_last_commit.txt \ + \ + # gdal project directory structure - has been changed ! + && if [ -d "gdal" ] ; then \ + echo "Directory 'gdal' dir exists -> older version!" ; \ + cd gdal ; \ + else \ + echo "Directory 'gdal' does not exists! Newer version! " ; \ + fi \ + \ + && if [ -f "./autogen.sh" ]; then \ + # Building with autoconf ( old/deprecated ) + set -eux \ + && ./autogen.sh \ + && ./configure --disable-static \ + ; \ + else \ + # Building with cmake + set -eux \ + && mkdir build \ + && cd build \ + # config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules + && cmake .. \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DBUILD_TESTING=OFF \ + -DBUILD_DOCS=OFF \ + \ + -DGDAL_HIDE_INTERNAL_SYMBOLS=ON \ + -DRENAME_INTERNAL_TIFF_SYMBOLS=ON \ + -DGDAL_USE_CURL=ON \ + -DGDAL_USE_DEFLATE=ON \ + -DGDAL_USE_EXPAT=ON \ + -DGDAL_USE_GEOS=ON \ + -DGDAL_USE_JSONC=ON \ + -DGDAL_USE_LIBLZMA=ON \ + -DGDAL_USE_LIBXML2=ON \ + -DGDAL_USE_LZ4=ON \ + -DGDAL_USE_POSTGRESQL=ON \ + -DGDAL_USE_SQLITE3=ON \ + -DGDAL_USE_TIFF=ON \ + -DGDAL_USE_WEBP=ON \ + -DGDAL_USE_ZLIB=ON \ + -DGDAL_USE_ZSTD=ON \ +# minimal GDAL build .. + ; \ + fi \ + \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/gdal + +# Minimal command line test. +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + && pcre-config --version + +# ------------------------------------------- +# final stage +# ------------------------------------------- +FROM ${PGIS1_BASE_IMAGE} + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS - 14-l3.1.9gcp spatial database extension with PostgreSQL 14 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ARG PGIS1_CMAKE_BUILD_TYPE +ARG PGIS1_BASE_IMAGE +ARG PGIS1_BOOST_VERSION + +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + PGIS1_BASE_IMAGE=${PGIS1_BASE_IMAGE} \ + PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +RUN set -eux \ + && apt-get update \ + && apt-get install -y -V --no-install-recommends \ + \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libpcre3 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=stage0-builder /_pgis*.* / +COPY --from=stage0-builder /usr/local /usr/local + +# minimal GDAL build; so no need extra dependencies + + +ARG PGIS1_GDAL_CHECKOUT +ARG PGIS1_GDAL_REPOSITORY +ARG PGIS1_GEOS_CHECKOUT +ARG PGIS1_GEOS_REPOSITORY +ARG PGIS1_PROJ_CHECKOUT +ARG PGIS1_PROJ_REPOSITORY +ARG PGIS1_SFCGAL_CHECKOUT +ARG PGIS1_SFCGAL_REPOSITORY +ARG PGIS1_CGAL_REPOSITORY +ARG PGIS1_CGAL_CHECKOUT + +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +ENV PGIS1_GDAL_CHECKOUT=${PGIS1_GDAL_CHECKOUT} \ + PGIS1_GDAL_REPOSITORY=${PGIS1_GDAL_REPOSITORY} \ + PGIS1_GEOS_CHECKOUT=${PGIS1_GEOS_CHECKOUT} \ + PGIS1_GEOS_REPOSITORY=${PGIS1_GEOS_REPOSITORY} \ + PGIS1_PROJ_CHECKOUT=${PGIS1_PROJ_CHECKOUT} \ + PGIS1_PROJ_REPOSITORY=${PGIS1_PROJ_REPOSITORY} \ + PGIS1_CGAL_CHECKOUT=${PGIS1_CGAL_CHECKOUT} \ + PGIS1_CGAL_REPOSITORY=${PGIS1_CGAL_REPOSITORY} \ + PGIS1_SFCGAL_CHECKOUT=${PGIS1_SFCGAL_CHECKOUT} \ + PGIS1_SFCGAL_REPOSITORY=${PGIS1_SFCGAL_REPOSITORY} \ + PGIS1_POSTGIS_CHECKOUT=${PGIS1_POSTGIS_CHECKOUT} \ + PGIS1_POSTGIS_REPOSITORY=${PGIS1_POSTGIS_REPOSITORY} + +# Minimal command line test ( fail fast ) +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + \ + # Testing ogr2ogr PostgreSQL driver. + && ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \ + || echo "ogr2ogr missing PostgreSQL driver" && exit 1 + +# Specify GDAL_CONFIG and LD_LIBRARY_PATH for PostGIS build; +# The arm64 build is very senitive. +ENV GDAL_CONFIG /usr/local/bin/gdal-config +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +# temporary workaround for : nitdb: invalid locale settings; check LANG and LC_* environment variables +# https://github.com/docker-library/postgres/issues/1112#issuecomment-1746076388 +RUN set -eux \ + && echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcunit1-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && cd \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_POSTGIS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_POSTGIS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_POSTGIS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping POSTGIS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ]; then \ + echo "POSTGIS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_last_commit.txt \ + && ldconfig \ + && ./autogen.sh \ +# configure options taken from: +# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ +# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316 + && if command -v projsync >/dev/null 2>&1; then \ + projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn ; \ + fi \ +# regress check + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && ldconfig \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# clean + && cd / \ + && rm -rf /usr/src/postgis \ + && apt-get purge -y --autoremove \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin + +# last final test +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + # check any missing dependencies + && ldd /usr/lib/postgresql/$PG_MAJOR/lib/*.so | grep 'not found' && exit 1 || true \ + \ + # Is the "ca-certificates" package installed? (for accessing remote raster files) + # https://github.com/postgis/docker-postgis/issues/307 + && dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \ + \ + # list last commits. + && find /_pgis*_commit.txt -type f -print -exec cat {} \; \ + # list postgresql, postgis version + && cat _pgis_full_version.txt diff --git a/14-l3.1.9gcp/bookworm/initdb-postgis.sh b/14-l3.1.9gcp/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/14-l3.1.9gcp/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/14-l3.1.9gcp/bookworm/tags b/14-l3.1.9gcp/bookworm/tags new file mode 100644 index 00000000..43c6f278 --- /dev/null +++ b/14-l3.1.9gcp/bookworm/tags @@ -0,0 +1 @@ +14-l3.1.9gcp-bookworm 14-l3.1.9gcp-postgis3.1.9-geos3.6.6-proj6.3.1-bookworm diff --git a/14-l3.1.9gcp/bookworm/update-postgis.sh b/14-l3.1.9gcp/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/14-l3.1.9gcp/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/15-3.3/alpine3.20/Dockerfile b/15-3.3/alpine3.20/Dockerfile new file mode 100644 index 00000000..8f32ed13 --- /dev/null +++ b/15-3.3/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:15-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.3.7 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=a0c796766cbcd369d871283f559fd97a186464dd + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 15 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/15-3.3/alpine3.20/initdb-postgis.sh b/15-3.3/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/15-3.3/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/15-3.3/alpine3.20/tags b/15-3.3/alpine3.20/tags new file mode 100644 index 00000000..7708eed1 --- /dev/null +++ b/15-3.3/alpine3.20/tags @@ -0,0 +1 @@ +15-3.3-alpine3.20 15-3.3.7-alpine3.20 15-3.3-alpine diff --git a/15-3.3/alpine3.20/update-postgis.sh b/15-3.3/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/15-3.3/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/15-3.4/alpine/Dockerfile b/15-3.4/alpine/Dockerfile deleted file mode 100644 index 21f1cd27..00000000 --- a/15-3.4/alpine/Dockerfile +++ /dev/null @@ -1,124 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. -# -ARG BASE_IMAGE=postgres:15-alpine3.18 -FROM ${BASE_IMAGE} - -LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0 spatial database extension with PostgreSQL 15 Alpine" \ - org.opencontainers.image.source="https://github.com/postgis/docker-postgis" - -ENV POSTGIS_VERSION 3.4.0 -ENV POSTGIS_SHA256 3acdf303adfd58d73543a70e6ebe99af29301262c56cf32220d42caa3efab024 - -RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ - && apk add --no-cache --virtual .build-deps \ - \ - gdal-dev \ - geos-dev \ - proj-dev \ - proj-util \ - sfcgal-dev \ - \ - # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains - # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. - # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 - $DOCKER_PG_LLVM_DEPS \ - \ - autoconf \ - automake \ - cunit-dev \ - file \ - g++ \ - gcc \ - gettext-dev \ - git \ - json-c-dev \ - libtool \ - libxml2-dev \ - make \ - pcre2-dev \ - perl \ - protobuf-c-dev \ - \ -# build PostGIS - with Link Time Optimization (LTO) enabled - && cd /usr/src/postgis \ - && gettextize \ - && ./autogen.sh \ - && ./configure \ - --enable-lto \ - && make -j$(nproc) \ - && make install \ - \ -# This section is for refreshing the proj data for the regression tests. -# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 -# This increases the Docker image size by about 1 MB. - && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ - && projsync --system-directory --file us_noaa_eshpgn \ - && projsync --system-directory --file us_noaa_prvi \ - && projsync --system-directory --file us_noaa_wmhpgn \ -# This section performs a regression check. - && mkdir /tempdb \ - && chown -R postgres:postgres /tempdb \ - && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ - && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ - \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ - && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ - \ - && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ - && rm -rf /tempdb \ - && rm -rf /tmp/logfile \ - && rm -rf /tmp/pgis_reg \ -# add .postgis-rundeps - && apk add --no-cache --virtual .postgis-rundeps \ - \ - gdal \ - geos \ - proj \ - sfcgal \ - \ - json-c \ - libstdc++ \ - pcre2 \ - protobuf-c \ - \ - # ca-certificates: for accessing remote raster files - # fix https://github.com/postgis/docker-postgis/issues/307 - ca-certificates \ -# clean - && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ -# At the end of the build, we print the collected information -# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. - && cat /_pgis_full_version.txt - -COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh -COPY ./update-postgis.sh /usr/local/bin diff --git a/15-3.4/alpine/initdb-postgis.sh b/15-3.4/alpine/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/15-3.4/alpine/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/15-3.4/alpine3.19/Dockerfile b/15-3.4/alpine3.19/Dockerfile new file mode 100644 index 00000000..31b73947 --- /dev/null +++ b/15-3.4/alpine3.19/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:15-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 15 alpine3.19" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/15-3.4/alpine3.19/initdb-postgis.sh b/15-3.4/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/15-3.4/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/15-3.4/alpine3.19/tags b/15-3.4/alpine3.19/tags new file mode 100644 index 00000000..9561d271 --- /dev/null +++ b/15-3.4/alpine3.19/tags @@ -0,0 +1 @@ +15-3.4-alpine3.19 15-3.4.3-alpine3.19 diff --git a/15-3.4/alpine3.19/update-postgis.sh b/15-3.4/alpine3.19/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/15-3.4/alpine3.19/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/15-3.4/alpine3.20/Dockerfile b/15-3.4/alpine3.20/Dockerfile new file mode 100644 index 00000000..ae9feee1 --- /dev/null +++ b/15-3.4/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:15-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 15 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/15-3.4/alpine3.20/initdb-postgis.sh b/15-3.4/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/15-3.4/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/15-3.4/alpine3.20/tags b/15-3.4/alpine3.20/tags new file mode 100644 index 00000000..f1d9a97a --- /dev/null +++ b/15-3.4/alpine3.20/tags @@ -0,0 +1 @@ +15-3.4-alpine3.20 15-3.4.3-alpine3.20 15-3.4-alpine diff --git a/15-3.4/alpine3.20/update-postgis.sh b/15-3.4/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/15-3.4/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/15-3.4/initdb-postgis.sh b/15-3.4/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/15-3.4/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/15-3.5/alpine3.19/Dockerfile b/15-3.5/alpine3.19/Dockerfile new file mode 100644 index 00000000..6155ce6f --- /dev/null +++ b/15-3.5/alpine3.19/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:15-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 15 alpine3.19" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/15-3.5/alpine3.19/initdb-postgis.sh b/15-3.5/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/15-3.5/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/15-3.5/alpine3.19/tags b/15-3.5/alpine3.19/tags new file mode 100644 index 00000000..2be00231 --- /dev/null +++ b/15-3.5/alpine3.19/tags @@ -0,0 +1 @@ +15-3.5-alpine3.19 15-3.5.0-alpine3.19 diff --git a/15-3.5/alpine3.19/update-postgis.sh b/15-3.5/alpine3.19/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/15-3.5/alpine3.19/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/15-3.5/alpine3.20/Dockerfile b/15-3.5/alpine3.20/Dockerfile new file mode 100644 index 00000000..63a02c99 --- /dev/null +++ b/15-3.5/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:15-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 15 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/15-3.5/alpine3.20/initdb-postgis.sh b/15-3.5/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/15-3.5/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/15-3.5/alpine3.20/tags b/15-3.5/alpine3.20/tags new file mode 100644 index 00000000..a438c715 --- /dev/null +++ b/15-3.5/alpine3.20/tags @@ -0,0 +1 @@ +15-3.5-alpine3.20 15-3.5.0-alpine3.20 15-3.5-alpine diff --git a/15-3.5/alpine3.20/update-postgis.sh b/15-3.5/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/15-3.5/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/15-3.5/bookworm/Dockerfile b/15-3.5/bookworm/Dockerfile new file mode 100644 index 00000000..153e0b49 --- /dev/null +++ b/15-3.5/bookworm/Dockerfile @@ -0,0 +1,39 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM postgres:15-bookworm + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg120+1 spatial database extension with PostgreSQL 15 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ENV POSTGIS_MAJOR 3 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg120+1 + +RUN set -eux \ + && apt-get update \ + && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ + && apt-get install -y --no-install-recommends \ + # ca-certificates: for accessing remote raster files; + # fix: https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ + \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ + && rm -rf /var/lib/apt/lists/* + +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/15-3.5/bookworm/initdb-postgis.sh b/15-3.5/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/15-3.5/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/15-3.5/bookworm/tags b/15-3.5/bookworm/tags new file mode 100644 index 00000000..4c34c05d --- /dev/null +++ b/15-3.5/bookworm/tags @@ -0,0 +1 @@ +15-3.5-bookworm 15-3.5.0-bookworm 15-3.5 diff --git a/15-3.5/bookworm/update-postgis.sh b/15-3.5/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/15-3.5/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/15-3.4/Dockerfile b/15-3.5/bullseye/Dockerfile similarity index 60% rename from 15-3.4/Dockerfile rename to 15-3.5/bullseye/Dockerfile index 05fd6411..25f1f540 100644 --- a/15-3.4/Dockerfile +++ b/15-3.5/bullseye/Dockerfile @@ -1,17 +1,19 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # - FROM postgres:15-bullseye LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 15 bullseye" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 15 bullseye" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR 3 -ENV POSTGIS_VERSION 3.4.0+dfsg-1.pgdg110+1 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1 -RUN apt-get update \ +RUN set -eux \ + && apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; @@ -20,9 +22,18 @@ RUN apt-get update \ \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ && rm -rf /var/lib/apt/lists/* +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + RUN mkdir -p /docker-entrypoint-initdb.d COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh COPY ./update-postgis.sh /usr/local/bin - diff --git a/15-3.5/bullseye/initdb-postgis.sh b/15-3.5/bullseye/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/15-3.5/bullseye/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/15-3.5/bullseye/tags b/15-3.5/bullseye/tags new file mode 100644 index 00000000..6402453e --- /dev/null +++ b/15-3.5/bullseye/tags @@ -0,0 +1 @@ +15-3.5-bullseye 15-3.5.0-bullseye diff --git a/15-3.5/bullseye/update-postgis.sh b/15-3.5/bullseye/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/15-3.5/bullseye/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/15-master/Dockerfile b/15-master/Dockerfile deleted file mode 100644 index 8a20da1b..00000000 --- a/15-master/Dockerfile +++ /dev/null @@ -1,462 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. -# - -# "Experimental"; solely for testing purposes. Anticipate frequent changes! -# This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05. - -ARG DOCKER_CMAKE_BUILD_TYPE=Release -ARG CGAL_GIT_BRANCH=5.6.x-branch -FROM postgres:15-bullseye as builder - -LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS - master spatial database extension with PostgreSQL 15 bullseye" \ - org.opencontainers.image.source="https://github.com/postgis/docker-postgis" - -WORKDIR / - -# apt-get install -RUN set -ex \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - curl \ - libboost-atomic1.74.0 \ - libboost-chrono1.74.0 \ - libboost-date-time1.74.0 \ - libboost-filesystem1.74.0 \ - libboost-program-options1.74.0 \ - libboost-serialization1.74.0 \ - libboost-system1.74.0 \ - libboost-test1.74.0 \ - libboost-thread1.74.0 \ - libboost-timer1.74.0 \ - libcurl3-gnutls \ - libexpat1 \ - libgmp10 \ - libgmpxx4ldbl \ - libjson-c5 \ - libmpfr6 \ - libprotobuf-c1 \ - libtiff5 \ - libxml2 \ - sqlite3 \ - # build dependency - autoconf \ - automake \ - autotools-dev \ - bison \ - build-essential \ - ca-certificates \ - cmake \ - g++ \ - git \ - libboost-all-dev \ - libcurl4-gnutls-dev \ - libgmp-dev \ - libjson-c-dev \ - libmpfr-dev \ - libpcre3-dev \ - libpq-dev \ - libprotobuf-c-dev \ - libsqlite3-dev \ - libtiff-dev \ - libtool \ - libxml2-dev \ - make \ - pkg-config \ - protobuf-c-compiler \ - xsltproc \ - # gdal+ - libblosc-dev \ - libcfitsio-dev \ - libfreexl-dev \ - libfyba-dev \ - libhdf5-dev \ - libkml-dev \ - liblz4-dev \ - liblzma-dev \ - libopenjp2-7-dev \ - libqhull-dev \ - libwebp-dev \ - libzstd-dev - -ARG DOCKER_CMAKE_BUILD_TYPE -ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} - -# cgal & sfcgal -# By utilizing the latest commit of the CGAL 5.x.x-branch and implementing a header-only build for SFCGAL, -# one can benefit from the latest CGAL patches while avoiding compatibility issues. -ARG CGAL_GIT_BRANCH -ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL5X_GIT_HASH 3c8e2053721271119499506ea1d8a49dee89e30c -ENV SFCGAL_GIT_HASH fc4dc5640e402c8b00426b5a3562324226725df9 -RUN set -ex \ - && mkdir -p /usr/src \ - && cd /usr/src \ - && git clone --branch ${CGAL_GIT_BRANCH} https://github.com/CGAL/cgal \ - && cd cgal \ - && git checkout ${CGAL5X_GIT_HASH} \ - && git log -1 > /_pgis_cgal_last_commit.txt \ - && cd /usr/src \ - && git clone https://gitlab.com/Oslandia/SFCGAL.git \ - && cd SFCGAL \ - && git checkout ${SFCGAL_GIT_HASH} \ - && git log -1 > /_pgis_sfcgal_last_commit.txt \ - && mkdir cmake-build \ - && cd cmake-build \ - && cmake .. \ - -DCGAL_DIR=/usr/src/cgal \ - -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} \ - -DSFCGAL_BUILD_BENCH=OFF \ - -DSFCGAL_BUILD_EXAMPLES=OFF \ - -DSFCGAL_BUILD_TESTS=OFF \ - -DSFCGAL_WITH_OSG=OFF \ - && make -j$(nproc) \ - && make install \ - # - ## testing with -DSFCGAL_BUILD_TESTS=ON - # && CTEST_OUTPUT_ON_FAILURE=TRUE ctest \ - # - # clean - && rm -fr /usr/src/SFCGAL \ - && rm -fr /usr/src/cgal - -# proj -ENV PROJ_GIT_HASH d4ebd920c1e1ecd0e192790ab4fdb98c7b982176 -RUN set -ex \ - && cd /usr/src \ - && git clone https://github.com/OSGeo/PROJ.git \ - && cd PROJ \ - && git checkout ${PROJ_GIT_HASH} \ - && git log -1 > /_pgis_proj_last_commit.txt \ - # check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027 - && if [ -f "autogen.sh" ] ; then \ - set -eux \ - && echo "autotools version: 'autogen.sh' exists! Older version!" \ - && ./autogen.sh \ - && ./configure --disable-static \ - && make -j$(nproc) \ - && make install \ - ; \ - else \ - set -eux \ - && echo "cmake version: 'autogen.sh' does not exists! Newer version!" \ - && mkdir build \ - && cd build \ - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ - && make -j$(nproc) \ - && make install \ - ; \ - fi \ - \ - && rm -fr /usr/src/PROJ - -# geos -ENV GEOS_GIT_HASH 1033161eca3684e0d9479daeafd35a4e0fb1800e -RUN set -ex \ - && cd /usr/src \ - && git clone https://github.com/libgeos/geos.git \ - && cd geos \ - && git checkout ${GEOS_GIT_HASH} \ - && git log -1 > /_pgis_geos_last_commit.txt \ - && mkdir cmake-build \ - && cd cmake-build \ - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ - && make -j$(nproc) \ - && make install \ - && cd / \ - && rm -fr /usr/src/geos - -# gdal -ENV GDAL_GIT_HASH 43e51bc48e7d48795ae60731ddc1414611ec5d3e -RUN set -ex \ - && cd /usr/src \ - && git clone https://github.com/OSGeo/gdal.git \ - && cd gdal \ - && git checkout ${GDAL_GIT_HASH} \ - && git log -1 > /_pgis_gdal_last_commit.txt \ - \ - # gdal project directory structure - has been changed ! - && if [ -d "gdal" ] ; then \ - echo "Directory 'gdal' dir exists -> older version!" ; \ - cd gdal ; \ - else \ - echo "Directory 'gdal' does not exists! Newer version! " ; \ - fi \ - \ - && if [ -f "./autogen.sh" ]; then \ - # Building with autoconf ( old/deprecated ) - set -eux \ - && ./autogen.sh \ - && ./configure --disable-static \ - ; \ - else \ - # Building with cmake - set -eux \ - && mkdir build \ - && cd build \ - # config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ - -DBUILD_DOCS=OFF \ - \ - -DGDAL_HIDE_INTERNAL_SYMBOLS=ON \ - -DRENAME_INTERNAL_TIFF_SYMBOLS=ON \ - -DGDAL_USE_BLOSC=ON \ - -DGDAL_USE_CFITSIO=ON \ - -DGDAL_USE_CURL=ON \ - -DGDAL_USE_DEFLATE=ON \ - -DGDAL_USE_EXPAT=ON \ - -DGDAL_USE_FREEXL=ON \ - -DGDAL_USE_FYBA=ON \ - -DGDAL_USE_GEOS=ON \ - -DGDAL_USE_HDF5=ON \ - -DGDAL_USE_JSONC=ON \ - -DGDAL_USE_LERC_INTERNAL=ON \ - -DGDAL_USE_LIBKML=ON \ - -DGDAL_USE_LIBLZMA=ON \ - -DGDAL_USE_LZ4=ON \ - -DGDAL_USE_OPENJPEG=ON \ - -DGDAL_USE_POSTGRESQL=ON \ - -DGDAL_USE_QHULL=ON \ - -DGDAL_USE_SQLITE3=ON \ - -DGDAL_USE_TIFF=ON \ - -DGDAL_USE_WEBP=ON \ - -DGDAL_USE_ZSTD=ON \ - \ - # OFF and Not working https://github.com/OSGeo/gdal/issues/7100 - # -DRENAME_INTERNAL_GEOTIFF_SYMBOLS=ON \ - -DGDAL_USE_ECW=OFF \ - -DGDAL_USE_GEOTIFF=OFF \ - -DGDAL_USE_HEIF=OFF \ - -DGDAL_USE_SPATIALITE=OFF \ - ; \ - fi \ - \ - && make -j$(nproc) \ - && make install \ - && cd / \ - && rm -fr /usr/src/gdal - -# Minimal command line test. -RUN set -ex \ - && ldconfig \ - && cs2cs \ - && ldd $(which gdalinfo) \ - && gdalinfo --version \ - && geos-config --version \ - && ogr2ogr --version \ - && proj \ - && sfcgal-config --version \ - && pcre-config --version - -# ------------------------------------------- -# STAGE final -# ------------------------------------------- -FROM postgres:15-bullseye - -ARG DOCKER_CMAKE_BUILD_TYPE -ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} - -RUN set -ex \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - curl \ - libboost-atomic1.74.0 \ - libboost-chrono1.74.0 \ - libboost-date-time1.74.0 \ - libboost-filesystem1.74.0 \ - libboost-program-options1.74.0 \ - libboost-serialization1.74.0 \ - libboost-system1.74.0 \ - libboost-test1.74.0 \ - libboost-thread1.74.0 \ - libboost-timer1.74.0 \ - libcurl3-gnutls \ - libexpat1 \ - libgmp10 \ - libgmpxx4ldbl \ - libjson-c5 \ - libmpfr6 \ - libpcre3 \ - libprotobuf-c1 \ - libtiff5 \ - libxml2 \ - sqlite3 \ - # gdal+ - libblosc1 \ - libcfitsio9 \ - libfreexl1 \ - libfyba0 \ - libhdf5-103-1 \ - libkmlbase1 \ - libkmldom1 \ - libkmlengine1 \ - libopenjp2-7 \ - libqhull-r8.0 \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=builder /_pgis*.* / -COPY --from=builder /usr/local /usr/local - -ARG CGAL_GIT_BRANCH -ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL5X_GIT_HASH 3c8e2053721271119499506ea1d8a49dee89e30c -ENV SFCGAL_GIT_HASH fc4dc5640e402c8b00426b5a3562324226725df9 -ENV PROJ_GIT_HASH d4ebd920c1e1ecd0e192790ab4fdb98c7b982176 -ENV GEOS_GIT_HASH 1033161eca3684e0d9479daeafd35a4e0fb1800e -ENV GDAL_GIT_HASH 43e51bc48e7d48795ae60731ddc1414611ec5d3e - -# Minimal command line test ( fail fast ) -RUN set -ex \ - && ldconfig \ - && cs2cs \ - && ldd $(which gdalinfo) \ - && gdalinfo --version \ - && gdal-config --formats \ - && geos-config --version \ - && ogr2ogr --version \ - && proj \ - && sfcgal-config --version \ - \ - # Testing ogr2ogr PostgreSQL driver. - && ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \ - || echo "ogr2ogr missing PostgreSQL driver" && exit 1 - -# install postgis -ENV POSTGIS_GIT_HASH d7b58458ea7cf8157d09f59e955820d3a4321892 - -RUN set -ex \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - autoconf \ - automake \ - autotools-dev \ - bison \ - build-essential \ - ca-certificates \ - cmake \ - docbook-xml \ - docbook5-xml \ - g++ \ - git \ - libboost-all-dev \ - libcunit1-dev \ - libcurl4-gnutls-dev \ - libgmp-dev \ - libjson-c-dev \ - libmpfr-dev \ - libpcre3-dev \ - libprotobuf-c-dev \ - libsqlite3-dev \ - libtiff-dev \ - libtool \ - libxml2-dev \ - libxml2-utils \ - make \ - pkg-config \ - postgresql-server-dev-$PG_MAJOR \ - protobuf-c-compiler \ - xsltproc \ - && cd \ - # postgis - && cd /usr/src/ \ - && git clone https://github.com/postgis/postgis.git \ - && cd postgis \ - && git checkout ${POSTGIS_GIT_HASH} \ - && git log -1 > /_pgis_last_commit.txt \ - && ./autogen.sh \ -# configure options taken from: -# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie - && ./configure \ - --enable-lto \ - && make -j$(nproc) \ - && make install \ -# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316 - && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ - && projsync --system-directory --file us_noaa_eshpgn \ - && projsync --system-directory --file us_noaa_prvi \ - && projsync --system-directory --file us_noaa_wmhpgn \ -# regress check - && mkdir /tempdb \ - && chown -R postgres:postgres /tempdb \ - && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ - && ldconfig \ - && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ - \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ - && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ - \ - && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ - && rm -rf /tempdb \ - && rm -rf /tmp/logfile \ - && rm -rf /tmp/pgis_reg \ -# clean - && cd / \ - && rm -rf /usr/src/postgis \ - && apt-get purge -y --autoremove \ - autoconf \ - automake \ - autotools-dev \ - bison \ - build-essential \ - cmake \ - docbook-xml \ - docbook5-xml \ - g++ \ - git \ - libboost-all-dev \ - libcurl4-gnutls-dev \ - libgmp-dev \ - libjson-c-dev \ - libmpfr-dev \ - libpcre3-dev \ - libprotobuf-c-dev \ - libsqlite3-dev \ - libtiff-dev \ - libtool \ - libxml2-dev \ - libxml2-utils \ - make \ - pkg-config \ - postgresql-server-dev-$PG_MAJOR \ - protobuf-c-compiler \ - xsltproc \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -RUN mkdir -p /docker-entrypoint-initdb.d -COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh -COPY ./update-postgis.sh /usr/local/bin - -# last final test -RUN set -ex \ - && ldconfig \ - && cs2cs \ - && ldd $(which gdalinfo) \ - && gdalinfo --version \ - && gdal-config --formats \ - && geos-config --version \ - && ogr2ogr --version \ - && proj \ - && sfcgal-config --version \ - \ - # Is the "ca-certificates" package installed? (for accessing remote raster files) - # https://github.com/postgis/docker-postgis/issues/307 - && dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \ - \ - # list last commits. - && find /_pgis_*_last_commit.txt -type f -print -exec cat {} \; \ - # list postgresql, postgis version - && cat _pgis_full_version.txt diff --git a/15-master/initdb-postgis.sh b/15-master/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/15-master/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/16-3.3/alpine3.20/Dockerfile b/16-3.3/alpine3.20/Dockerfile new file mode 100644 index 00000000..2b803356 --- /dev/null +++ b/16-3.3/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:16-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.3.7 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=a0c796766cbcd369d871283f559fd97a186464dd + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 16 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/16-3.3/alpine3.20/initdb-postgis.sh b/16-3.3/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-3.3/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-3.3/alpine3.20/tags b/16-3.3/alpine3.20/tags new file mode 100644 index 00000000..c34cf930 --- /dev/null +++ b/16-3.3/alpine3.20/tags @@ -0,0 +1 @@ +16-3.3-alpine3.20 16-3.3.7-alpine3.20 16-3.3-alpine diff --git a/16-3.3/alpine3.20/update-postgis.sh b/16-3.3/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-3.3/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/16-3.4/alpine/Dockerfile b/16-3.4/alpine/Dockerfile deleted file mode 100644 index 5fb7cc3c..00000000 --- a/16-3.4/alpine/Dockerfile +++ /dev/null @@ -1,124 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. -# -ARG BASE_IMAGE=postgres:16-alpine3.18 -FROM ${BASE_IMAGE} - -LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0 spatial database extension with PostgreSQL 16 Alpine" \ - org.opencontainers.image.source="https://github.com/postgis/docker-postgis" - -ENV POSTGIS_VERSION 3.4.0 -ENV POSTGIS_SHA256 3acdf303adfd58d73543a70e6ebe99af29301262c56cf32220d42caa3efab024 - -RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ - && apk add --no-cache --virtual .build-deps \ - \ - gdal-dev \ - geos-dev \ - proj-dev \ - proj-util \ - sfcgal-dev \ - \ - # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains - # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. - # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 - $DOCKER_PG_LLVM_DEPS \ - \ - autoconf \ - automake \ - cunit-dev \ - file \ - g++ \ - gcc \ - gettext-dev \ - git \ - json-c-dev \ - libtool \ - libxml2-dev \ - make \ - pcre2-dev \ - perl \ - protobuf-c-dev \ - \ -# build PostGIS - with Link Time Optimization (LTO) enabled - && cd /usr/src/postgis \ - && gettextize \ - && ./autogen.sh \ - && ./configure \ - --enable-lto \ - && make -j$(nproc) \ - && make install \ - \ -# This section is for refreshing the proj data for the regression tests. -# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 -# This increases the Docker image size by about 1 MB. - && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ - && projsync --system-directory --file us_noaa_eshpgn \ - && projsync --system-directory --file us_noaa_prvi \ - && projsync --system-directory --file us_noaa_wmhpgn \ -# This section performs a regression check. - && mkdir /tempdb \ - && chown -R postgres:postgres /tempdb \ - && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ - && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ - \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ - && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ - \ - && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ - && rm -rf /tempdb \ - && rm -rf /tmp/logfile \ - && rm -rf /tmp/pgis_reg \ -# add .postgis-rundeps - && apk add --no-cache --virtual .postgis-rundeps \ - \ - gdal \ - geos \ - proj \ - sfcgal \ - \ - json-c \ - libstdc++ \ - pcre2 \ - protobuf-c \ - \ - # ca-certificates: for accessing remote raster files - # fix https://github.com/postgis/docker-postgis/issues/307 - ca-certificates \ -# clean - && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ -# At the end of the build, we print the collected information -# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. - && cat /_pgis_full_version.txt - -COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh -COPY ./update-postgis.sh /usr/local/bin diff --git a/16-3.4/alpine/initdb-postgis.sh b/16-3.4/alpine/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/16-3.4/alpine/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/16-3.4/alpine3.19/Dockerfile b/16-3.4/alpine3.19/Dockerfile new file mode 100644 index 00000000..e7b68086 --- /dev/null +++ b/16-3.4/alpine3.19/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:16-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 16 alpine3.19" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/16-3.4/alpine3.19/initdb-postgis.sh b/16-3.4/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-3.4/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-3.4/alpine3.19/tags b/16-3.4/alpine3.19/tags new file mode 100644 index 00000000..2a2d42cb --- /dev/null +++ b/16-3.4/alpine3.19/tags @@ -0,0 +1 @@ +16-3.4-alpine3.19 16-3.4.3-alpine3.19 diff --git a/16-3.4/alpine3.19/update-postgis.sh b/16-3.4/alpine3.19/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-3.4/alpine3.19/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/16-3.4/alpine3.20/Dockerfile b/16-3.4/alpine3.20/Dockerfile new file mode 100644 index 00000000..5b73f50d --- /dev/null +++ b/16-3.4/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:16-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 16 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/16-3.4/alpine3.20/initdb-postgis.sh b/16-3.4/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-3.4/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-3.4/alpine3.20/tags b/16-3.4/alpine3.20/tags new file mode 100644 index 00000000..ee68de5c --- /dev/null +++ b/16-3.4/alpine3.20/tags @@ -0,0 +1 @@ +16-3.4-alpine3.20 16-3.4.3-alpine3.20 16-3.4-alpine diff --git a/16-3.4/alpine3.20/update-postgis.sh b/16-3.4/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-3.4/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/16-3.4/initdb-postgis.sh b/16-3.4/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/16-3.4/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/16-3.5-bundle0/bookworm/Dockerfile b/16-3.5-bundle0/bookworm/Dockerfile new file mode 100644 index 00000000..ebc1ac4f --- /dev/null +++ b/16-3.5-bundle0/bookworm/Dockerfile @@ -0,0 +1,434 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.bundle0.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + + +# Experimental Geo Bundle package. +# This is a work in progress and not yet ready for production. +# Some packages will be removed from this bundle and others will be added. +# The goal is to have a bundle that includes all the most popular extensions with PostGIS + +# set the base image , make build-* is overwriting with the actual value ! + +ARG REGISTRY=docker.io +ARG REPO_NAME=imresamu +ARG IMAGE_NAME=postgis-amd64 + +ARG PGIS1_BASE_IMAGE=${REGISTRY}/${REPO_NAME}/${IMAGE_NAME}:16-3.5-bookworm + +ARG PGIS1_MOBILITYDB_REPOSITORY=https://github.com/MobilityDB/MobilityDB.git +ARG PGIS1_MOBILITYDB_CHECKOUT=tags/v1.2.0 +ARG PGIS1_MOBILITYDB_CHECKOUT_SHA1=60048b5b4b7ce2f7560c024d1af024db73b3bd5b + +ARG PGIS1_PGSQL_HTTP_REPOSITORY=https://github.com/pramsey/pgsql-http.git +ARG PGIS1_PGSQL_HTTP_CHECKOUT=tags/v1.6.1 +ARG PGIS1_PGSQL_HTTP_CHECKOUT_SHA1=5e2bd270a9ce2b0e8e1fdf8e46b85396bd4125cd + +ARG PGIS1_PGSQL_GZIP_REPOSITORY=https://github.com/pramsey/pgsql-gzip.git +ARG PGIS1_PGSQL_GZIP_CHECKOUT=tags/v1.0.0 +ARG PGIS1_PGSQL_GZIP_CHECKOUT_SHA1=7c26e8b0056631ec0bb7c8fdd9bf2a24076e4a49 + +ARG PGIS1_TIMESCALEDB_APACHE_ONLY=false +ARG PGIS1_TIMESCALEDB_REPOSITORY=https://github.com/timescale/timescaledb.git +ARG PGIS1_TIMESCALEDB_CHECKOUT=tags/2.17.2 +ARG PGIS1_TIMESCALEDB_CHECKOUT_SHA1=b359d26de186ea43f93c28c08cd1b8c6449c91bd + +ARG PGIS1_PG_HINT_PLAN_REPOSITORY=https://github.com/ossc-db/pg_hint_plan.git +ARG PGIS1_PG_HINT_PLAN_CHECKOUT=tags/REL16_1_6_1 +ARG PGIS1_PG_HINT_PLAN_CHECKOUT_SHA1=54b4b0358a6c96dc80b2b836bba50937415753b6 + +ARG PGIS1_DUCKDB_CHECKOUT=tags/v1.1.3 + +FROM ${PGIS1_BASE_IMAGE} AS builder + +ARG PGIS1_DUCKDB_CHECKOUT + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + cmake \ + curl \ + flex \ + g++ \ + git \ + make \ + pgxnclient \ + postgresql-server-dev-$PG_MAJOR \ + unzip \ + wget \ + # MobilityDB + libgeos++-dev \ + libgsl-dev \ + libjson-c-dev \ + libproj-dev \ + # TimescaleDB + libkrb5-dev \ + # pgsql-http + libcurl4-gnutls-dev \ + # hydra (columnar) + liblz4-dev \ + # pgsql-gzip + zlib1g-dev \ + # sqlite_fdw + sqlite3 \ + # plv8 + ninja-build \ + pkg-config \ + # bytemagic + libmagic-dev \ + # pgsoudium \ + libsodium-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +FROM builder as builder-http-gzip + +ARG PGIS1_PGSQL_HTTP_REPOSITORY +ARG PGIS1_PGSQL_HTTP_CHECKOUT +ARG PGIS1_PGSQL_HTTP_CHECKOUT_SHA1 + +ARG PGIS1_PGSQL_GZIP_REPOSITORY +ARG PGIS1_PGSQL_GZIP_CHECKOUT +ARG PGIS1_PGSQL_GZIP_CHECKOUT_SHA1 + +RUN set -eux \ + && mkdir -p /pgsql-gzip \ + && cd pgsql-gzip \ + && git init \ + && git remote add origin ${PGIS1_PGSQL_GZIP_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PGSQL_GZIP_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_PGSQL_GZIP_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgsql_gzip_last_commit.txt \ + && make -j$(nproc) \ + && make install + +RUN set -eux \ + && mkdir -p /pgsql-http \ + && cd pgsql-http \ + && git init \ + && git remote add origin ${PGIS1_PGSQL_HTTP_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PGSQL_HTTP_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_PGSQL_HTTP_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgsql_http_last_commit.txt \ + && make -j$(nproc) \ + && make install + + +FROM builder as builder-timescaledb + +ARG PGIS1_TIMESCALEDB_APACHE_ONLY +ARG PGIS1_TIMESCALEDB_REPOSITORY +ARG PGIS1_TIMESCALEDB_CHECKOUT +ARG PGIS1_TIMESCALEDB_CHECKOUT_SHA1 + +# Install TimescaleDB; no Arm64 apt support, so build from source +RUN set -eux \ + && mkdir -p /timescaledb \ + && cd timescaledb \ + && git init \ + && git remote add origin ${PGIS1_TIMESCALEDB_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_TIMESCALEDB_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_TIMESCALEDB_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_timescaledb_last_commit.txt \ + && ./bootstrap \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ + -DCMAKE_POLICY_DEFAULT_CMP0069=NEW \ + \ + -DAPACHE_ONLY=${PGIS1_TIMESCALEDB_APACHE_ONLY} \ + -DREGRESS_CHECKS=OFF \ + -DSEND_TELEMETRY_DEFAULT=NO \ + -DTAP_CHECKS=OFF \ + -DWARNINGS_AS_ERRORS=OFF \ + -DENABLE_DEBUG_UTILS=OFF \ + && cd build \ + && make -j$(nproc) \ + && make install + +FROM builder as builder-mobilitydb + +ARG PGIS1_MOBILITYDB_REPOSITORY +ARG PGIS1_MOBILITYDB_CHECKOUT +ARG PGIS1_MOBILITYDB_CHECKOUT_SHA1 + +# Install MobilityDB +RUN set -eux \ + && mkdir -p /MobilityDB \ + && cd MobilityDB \ + && git init \ + && git remote add origin ${PGIS1_MOBILITYDB_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_MOBILITYDB_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_MOBILITYDB_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_MobilityDB_last_commit.txt \ + && mkdir build \ + && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ + -DCMAKE_POLICY_DEFAULT_CMP0069=NEW \ + .. \ + && make -j$(nproc) \ + && make install + + +FROM builder as builder-pgxn + +RUN pgxn install --verbose byteamagic +RUN pgxn install --verbose ddlx +RUN pgxn install --verbose dsef +RUN pgxn install --verbose json_accessors +RUN pgxn install --verbose lostgis + +#RUN pgxn install --verbose parray_gin # not working on CircleCI arm .. yet +RUN pgxn install --verbose permuteseq +RUN pgxn install --verbose pg_curl # https://github.com/RekGRpth/pg_curl +RUN pgxn install --verbose pg_roaringbitmap +RUN pgxn install --verbose pg_rowalesce +RUN pgxn install --verbose pg_uuidv7 +RUN pgxn install --verbose pg_xenophile +RUN pgxn install --verbose pg_xxhash +RUN pgxn install --verbose pgsodium +RUN pgxn install --verbose pgsql_tweaks + +RUN USE_PGXS=1 pgxn install sqlite_fdw + + +FROM builder as builder-other + +ARG PGIS1_PG_HINT_PLAN_REPOSITORY +ARG PGIS1_PG_HINT_PLAN_CHECKOUT +ARG PGIS1_PG_HINT_PLAN_CHECKOUT_SHA1 + + +# Add hydradatabase +RUN set -eux \ + && git clone --depth 1 https://github.com/hydradatabase/hydra \ + && cd hydra/columnar \ + && git checkout main \ + && export COLUMNAR_O3=1 \ + && ./configure \ + && make -j$(nproc) \ + && make install + +# # # pg_quack is not available for PG16 +# # - https://github.com/hydradatabase/pg_quack/issues/3 +# +# install pg_hint_plan +RUN set -eux \ + && mkdir pg_hint_plan \ + && cd pg_hint_plan \ + && git init \ + && git remote add origin ${PGIS1_PG_HINT_PLAN_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PG_HINT_PLAN_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_PG_HINT_PLAN_CHECKOUT_SHA1" ]; then exit 1; fi \ + && make -j$(nproc) \ + && make install + +RUN set -eux \ + && git clone --depth 1 https://github.com/NikolayS/postgres_dba.git \ + && cd postgres_dba \ + && rm -rf .git + +RUN set -eux \ + && git clone --depth 1 https://github.com/dr-jts/pg_svg.git \ + && cd pg_svg \ + && rm -rf .git + #install: psql < /pg_svg/pg-svg-lib.sql + +FROM ${REGISTRY}/${REPO_NAME}/${IMAGE_NAME}:16-3.5-bookworm + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS Bundle - 16-3.5-bookworm " \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +# install all utf8 locales; +# helping: https://github.com/docker-library/docs/tree/master/postgres#locale-customization +RUN set -eux \ + && sed -i -e 's/# \(.*\.UTF-8\)/\1/' /etc/locale.gen \ + && locale-gen + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + \ + bzip2 \ + curl \ + jq \ + unzip \ + wget \ + \ + gdal-bin \ + proj-bin \ + sqlite3 \ + \ + pipx \ + python-is-python3 \ + python3 \ + python3-geoalchemy2 \ + python3-pglast \ + python3-pip \ + python3-psycopg2 \ + python3-setuptools \ + python3-sqlalchemy \ + \ + postgis \ + postgresql \ + postgresql-client-common \ + postgresql-common \ + postgresql-contrib \ + postgresql-plpython3-$PG_MAJOR \ + postgresql-postgis \ + postgresql-postgis-scripts \ + \ + pg-activity \ + pgbackrest \ + pgbadger \ + pgtap \ + pgtop \ + pspg \ + vip-manager \ + \ + postgresql-$PG_MAJOR-age \ + postgresql-$PG_MAJOR-decoderbufs \ + \ + postgresql-$PG_MAJOR-asn1oid \ + postgresql-$PG_MAJOR-cron \ + postgresql-$PG_MAJOR-extra-window-functions \ + postgresql-$PG_MAJOR-first-last-agg \ + postgresql-$PG_MAJOR-h3 \ + postgresql-$PG_MAJOR-hll \ + postgresql-$PG_MAJOR-hypopg \ + postgresql-$PG_MAJOR-icu-ext \ + postgresql-$PG_MAJOR-jsquery \ + postgresql-$PG_MAJOR-numeral \ + postgresql-$PG_MAJOR-ogr-fdw \ + postgresql-$PG_MAJOR-partman \ + postgresql-$PG_MAJOR-periods \ + postgresql-$PG_MAJOR-pg-fact-loader \ + postgresql-$PG_MAJOR-pg-failover-slots \ + postgresql-$PG_MAJOR-pg-stat-kcache \ + postgresql-$PG_MAJOR-pg-wait-sampling \ + postgresql-$PG_MAJOR-pgaudit \ + postgresql-$PG_MAJOR-pgl-ddl-deploy \ + postgresql-$PG_MAJOR-pglogical \ + postgresql-$PG_MAJOR-pgmp \ + postgresql-$PG_MAJOR-pgpcre \ + postgresql-$PG_MAJOR-pgq3 \ + postgresql-$PG_MAJOR-pgrouting \ + postgresql-$PG_MAJOR-pgrouting-scripts \ + postgresql-$PG_MAJOR-pgsphere \ + postgresql-$PG_MAJOR-pgtap \ + postgresql-$PG_MAJOR-pgvector \ + postgresql-$PG_MAJOR-pldebugger \ + postgresql-$PG_MAJOR-plpgsql-check \ + postgresql-$PG_MAJOR-pointcloud \ + postgresql-$PG_MAJOR-prefix \ + postgresql-$PG_MAJOR-prioritize \ + postgresql-$PG_MAJOR-q3c \ + postgresql-$PG_MAJOR-repack \ + postgresql-$PG_MAJOR-rum \ + postgresql-$PG_MAJOR-show-plans \ + postgresql-$PG_MAJOR-squeeze \ + # add MobilityDb missing dependency from libgsl-dev + libgsl27 \ + # MeCab based tokenizer for pgdg-pgroonga + groonga-tokenizer-mecab \ + # bytemagic + libmagic1 libmagic-mgc \ + # pgsodium + libsodium23 \ + \ + && rm -Rf /root/.cache/pip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ARG PGIS1_DUCKDB_CHECKOUT +ENV PGIS1_DUCKDB_CHECKOUT=${PGIS1_DUCKDB_CHECKOUT} +RUN arch=$(uname -m) \ + && DUCKDB_VERSION=$(echo "$PGIS1_DUCKDB_CHECKOUT" | sed 's/tags\///') \ + && echo "DUCKDB_VERSION=${DUCKDB_VERSION}" \ + && echo "PGIS1_DUCKDB_CHECKOUT=${PGIS1_DUCKDB_CHECKOUT}" \ + && case "$arch" in \ + x86_64) \ + duck_binary="duckdb_cli-linux-amd64.zip" ;; \ + aarch64) \ + duck_binary="duckdb_cli-linux-aarch64.zip" ;; \ + *) \ + echo "Unsupported architecture: $arch"; exit 1 ;; \ + esac \ + && wget https://github.com/duckdb/duckdb/releases/download/${DUCKDB_VERSION}/$duck_binary \ + && unzip $duck_binary -d /usr/local/bin \ + && rm $duck_binary \ + && duckdb --version + +# install extensions +# https://duckdb.org/docs/extensions/overview.html +ENV DUCKDB_EXTENSIONS="arrow autocomplete excel fts httpfs icu inet json parquet postgres_scanner spatial sqlite_scanner substrait tpcds tpch visualizer" +RUN for e in ${DUCKDB_EXTENSIONS} ; do \ + echo "Installing $e ..."; \ + duckdb -c "INSTALL $e;"; \ + echo "LOAD $e;" >> $HOME/.duckdbrc; \ + done + +# Install from stages +COPY --from=builder-http-gzip /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-http-gzip /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-mobilitydb /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-mobilitydb /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-timescaledb /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-timescaledb /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-pgxn /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-pgxn /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-other /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-other /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-other /postgres_dba /postgres_dba +COPY --from=builder-other /pg_svg /pg_svg + +# check any missing dependencies +RUN set -eux \ + && ldd /usr/lib/postgresql/$PG_MAJOR/lib/*.so | grep 'not found' && exit 1 || true + +# multiple LLVM existance is not optimal; so we give a warning. +# known problem: duplicated LLVM +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "WARNING: More than one llvm package or none at all found!"; \ + dpkg -l | grep llvm ; \ + fi + +# add MobilityDB requirements +RUN set -eux \ + && cp -v /usr/share/postgresql/postgresql.conf.sample /usr/share/postgresql/postgresql.conf.sample.orig; \ + # add MobilityDB and TimescaleDB requirements + echo "shared_preload_libraries = 'pg_hint_plan,postgis-3,timescaledb,pg_cron,pg_stat_statements'" >> /usr/share/postgresql/postgresql.conf.sample; \ + # MobilityDB recomendation + echo "max_locks_per_transaction = 128" >> /usr/share/postgresql/postgresql.conf.sample; \ + echo "timescaledb.telemetry_level=off" >> /usr/share/postgresql/postgresql.conf.sample + +# for postgres_dba Use ":dba" to see menu +RUN printf "%s %s %s %s\n" \\set dba \'\\\\i /postgres_dba/start.psql\' >> ~/.psqlrc + +COPY ./initdb-bundle0.sh /docker-entrypoint-initdb.d/11_bundle0.sh diff --git a/16-3.5-bundle0/bookworm/initdb-bundle0.sh b/16-3.5-bundle0/bookworm/initdb-bundle0.sh new file mode 100644 index 00000000..5f2c5d11 --- /dev/null +++ b/16-3.5-bundle0/bookworm/initdb-bundle0.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# install pg-svg-lib +"${psql[@]}" /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/16-3.5/alpine3.19/initdb-postgis.sh b/16-3.5/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-3.5/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-3.5/alpine3.19/tags b/16-3.5/alpine3.19/tags new file mode 100644 index 00000000..01925efa --- /dev/null +++ b/16-3.5/alpine3.19/tags @@ -0,0 +1 @@ +16-3.5-alpine3.19 16-3.5.0-alpine3.19 diff --git a/16-3.5/alpine3.19/update-postgis.sh b/16-3.5/alpine3.19/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-3.5/alpine3.19/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/16-3.5/alpine3.20/Dockerfile b/16-3.5/alpine3.20/Dockerfile new file mode 100644 index 00000000..840e95fa --- /dev/null +++ b/16-3.5/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:16-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 16 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/16-3.5/alpine3.20/initdb-postgis.sh b/16-3.5/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-3.5/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-3.5/alpine3.20/tags b/16-3.5/alpine3.20/tags new file mode 100644 index 00000000..7db4f3d4 --- /dev/null +++ b/16-3.5/alpine3.20/tags @@ -0,0 +1 @@ +16-3.5-alpine3.20 16-3.5.0-alpine3.20 16-3.5-alpine diff --git a/16-3.5/alpine3.20/update-postgis.sh b/16-3.5/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-3.5/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/16-3.5/bookworm/Dockerfile b/16-3.5/bookworm/Dockerfile new file mode 100644 index 00000000..a42a2f5e --- /dev/null +++ b/16-3.5/bookworm/Dockerfile @@ -0,0 +1,39 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM postgres:16-bookworm + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg120+1 spatial database extension with PostgreSQL 16 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ENV POSTGIS_MAJOR 3 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg120+1 + +RUN set -eux \ + && apt-get update \ + && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ + && apt-get install -y --no-install-recommends \ + # ca-certificates: for accessing remote raster files; + # fix: https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ + \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ + && rm -rf /var/lib/apt/lists/* + +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/16-3.5/bookworm/initdb-postgis.sh b/16-3.5/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-3.5/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-3.5/bookworm/tags b/16-3.5/bookworm/tags new file mode 100644 index 00000000..71ac787a --- /dev/null +++ b/16-3.5/bookworm/tags @@ -0,0 +1 @@ +16-3.5-bookworm 16-3.5.0-bookworm 16-3.5 diff --git a/16-3.5/bookworm/update-postgis.sh b/16-3.5/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-3.5/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/16-3.4/Dockerfile b/16-3.5/bullseye/Dockerfile similarity index 60% rename from 16-3.4/Dockerfile rename to 16-3.5/bullseye/Dockerfile index 0d16c535..2a404356 100644 --- a/16-3.4/Dockerfile +++ b/16-3.5/bullseye/Dockerfile @@ -1,17 +1,19 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # - FROM postgres:16-bullseye LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.4.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 16 bullseye" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 16 bullseye" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR 3 -ENV POSTGIS_VERSION 3.4.0+dfsg-1.pgdg110+1 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1 -RUN apt-get update \ +RUN set -eux \ + && apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; @@ -20,9 +22,18 @@ RUN apt-get update \ \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ && rm -rf /var/lib/apt/lists/* +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + RUN mkdir -p /docker-entrypoint-initdb.d COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh COPY ./update-postgis.sh /usr/local/bin - diff --git a/16-3.5/bullseye/initdb-postgis.sh b/16-3.5/bullseye/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-3.5/bullseye/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-3.5/bullseye/tags b/16-3.5/bullseye/tags new file mode 100644 index 00000000..547297fe --- /dev/null +++ b/16-3.5/bullseye/tags @@ -0,0 +1 @@ +16-3.5-bullseye 16-3.5.0-bullseye diff --git a/16-3.5/bullseye/update-postgis.sh b/16-3.5/bullseye/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-3.5/bullseye/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/16-master/Dockerfile b/16-master/Dockerfile deleted file mode 100644 index 2c2efae4..00000000 --- a/16-master/Dockerfile +++ /dev/null @@ -1,462 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. -# - -# "Experimental"; solely for testing purposes. Anticipate frequent changes! -# This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05. - -ARG DOCKER_CMAKE_BUILD_TYPE=Release -ARG CGAL_GIT_BRANCH=5.6.x-branch -FROM postgres:16-bullseye as builder - -LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS - master spatial database extension with PostgreSQL 16 bullseye" \ - org.opencontainers.image.source="https://github.com/postgis/docker-postgis" - -WORKDIR / - -# apt-get install -RUN set -ex \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - curl \ - libboost-atomic1.74.0 \ - libboost-chrono1.74.0 \ - libboost-date-time1.74.0 \ - libboost-filesystem1.74.0 \ - libboost-program-options1.74.0 \ - libboost-serialization1.74.0 \ - libboost-system1.74.0 \ - libboost-test1.74.0 \ - libboost-thread1.74.0 \ - libboost-timer1.74.0 \ - libcurl3-gnutls \ - libexpat1 \ - libgmp10 \ - libgmpxx4ldbl \ - libjson-c5 \ - libmpfr6 \ - libprotobuf-c1 \ - libtiff5 \ - libxml2 \ - sqlite3 \ - # build dependency - autoconf \ - automake \ - autotools-dev \ - bison \ - build-essential \ - ca-certificates \ - cmake \ - g++ \ - git \ - libboost-all-dev \ - libcurl4-gnutls-dev \ - libgmp-dev \ - libjson-c-dev \ - libmpfr-dev \ - libpcre3-dev \ - libpq-dev \ - libprotobuf-c-dev \ - libsqlite3-dev \ - libtiff-dev \ - libtool \ - libxml2-dev \ - make \ - pkg-config \ - protobuf-c-compiler \ - xsltproc \ - # gdal+ - libblosc-dev \ - libcfitsio-dev \ - libfreexl-dev \ - libfyba-dev \ - libhdf5-dev \ - libkml-dev \ - liblz4-dev \ - liblzma-dev \ - libopenjp2-7-dev \ - libqhull-dev \ - libwebp-dev \ - libzstd-dev - -ARG DOCKER_CMAKE_BUILD_TYPE -ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} - -# cgal & sfcgal -# By utilizing the latest commit of the CGAL 5.x.x-branch and implementing a header-only build for SFCGAL, -# one can benefit from the latest CGAL patches while avoiding compatibility issues. -ARG CGAL_GIT_BRANCH -ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL5X_GIT_HASH 3c8e2053721271119499506ea1d8a49dee89e30c -ENV SFCGAL_GIT_HASH fc4dc5640e402c8b00426b5a3562324226725df9 -RUN set -ex \ - && mkdir -p /usr/src \ - && cd /usr/src \ - && git clone --branch ${CGAL_GIT_BRANCH} https://github.com/CGAL/cgal \ - && cd cgal \ - && git checkout ${CGAL5X_GIT_HASH} \ - && git log -1 > /_pgis_cgal_last_commit.txt \ - && cd /usr/src \ - && git clone https://gitlab.com/Oslandia/SFCGAL.git \ - && cd SFCGAL \ - && git checkout ${SFCGAL_GIT_HASH} \ - && git log -1 > /_pgis_sfcgal_last_commit.txt \ - && mkdir cmake-build \ - && cd cmake-build \ - && cmake .. \ - -DCGAL_DIR=/usr/src/cgal \ - -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} \ - -DSFCGAL_BUILD_BENCH=OFF \ - -DSFCGAL_BUILD_EXAMPLES=OFF \ - -DSFCGAL_BUILD_TESTS=OFF \ - -DSFCGAL_WITH_OSG=OFF \ - && make -j$(nproc) \ - && make install \ - # - ## testing with -DSFCGAL_BUILD_TESTS=ON - # && CTEST_OUTPUT_ON_FAILURE=TRUE ctest \ - # - # clean - && rm -fr /usr/src/SFCGAL \ - && rm -fr /usr/src/cgal - -# proj -ENV PROJ_GIT_HASH d4ebd920c1e1ecd0e192790ab4fdb98c7b982176 -RUN set -ex \ - && cd /usr/src \ - && git clone https://github.com/OSGeo/PROJ.git \ - && cd PROJ \ - && git checkout ${PROJ_GIT_HASH} \ - && git log -1 > /_pgis_proj_last_commit.txt \ - # check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027 - && if [ -f "autogen.sh" ] ; then \ - set -eux \ - && echo "autotools version: 'autogen.sh' exists! Older version!" \ - && ./autogen.sh \ - && ./configure --disable-static \ - && make -j$(nproc) \ - && make install \ - ; \ - else \ - set -eux \ - && echo "cmake version: 'autogen.sh' does not exists! Newer version!" \ - && mkdir build \ - && cd build \ - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ - && make -j$(nproc) \ - && make install \ - ; \ - fi \ - \ - && rm -fr /usr/src/PROJ - -# geos -ENV GEOS_GIT_HASH 1033161eca3684e0d9479daeafd35a4e0fb1800e -RUN set -ex \ - && cd /usr/src \ - && git clone https://github.com/libgeos/geos.git \ - && cd geos \ - && git checkout ${GEOS_GIT_HASH} \ - && git log -1 > /_pgis_geos_last_commit.txt \ - && mkdir cmake-build \ - && cd cmake-build \ - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ - && make -j$(nproc) \ - && make install \ - && cd / \ - && rm -fr /usr/src/geos - -# gdal -ENV GDAL_GIT_HASH 43e51bc48e7d48795ae60731ddc1414611ec5d3e -RUN set -ex \ - && cd /usr/src \ - && git clone https://github.com/OSGeo/gdal.git \ - && cd gdal \ - && git checkout ${GDAL_GIT_HASH} \ - && git log -1 > /_pgis_gdal_last_commit.txt \ - \ - # gdal project directory structure - has been changed ! - && if [ -d "gdal" ] ; then \ - echo "Directory 'gdal' dir exists -> older version!" ; \ - cd gdal ; \ - else \ - echo "Directory 'gdal' does not exists! Newer version! " ; \ - fi \ - \ - && if [ -f "./autogen.sh" ]; then \ - # Building with autoconf ( old/deprecated ) - set -eux \ - && ./autogen.sh \ - && ./configure --disable-static \ - ; \ - else \ - # Building with cmake - set -eux \ - && mkdir build \ - && cd build \ - # config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ - -DBUILD_DOCS=OFF \ - \ - -DGDAL_HIDE_INTERNAL_SYMBOLS=ON \ - -DRENAME_INTERNAL_TIFF_SYMBOLS=ON \ - -DGDAL_USE_BLOSC=ON \ - -DGDAL_USE_CFITSIO=ON \ - -DGDAL_USE_CURL=ON \ - -DGDAL_USE_DEFLATE=ON \ - -DGDAL_USE_EXPAT=ON \ - -DGDAL_USE_FREEXL=ON \ - -DGDAL_USE_FYBA=ON \ - -DGDAL_USE_GEOS=ON \ - -DGDAL_USE_HDF5=ON \ - -DGDAL_USE_JSONC=ON \ - -DGDAL_USE_LERC_INTERNAL=ON \ - -DGDAL_USE_LIBKML=ON \ - -DGDAL_USE_LIBLZMA=ON \ - -DGDAL_USE_LZ4=ON \ - -DGDAL_USE_OPENJPEG=ON \ - -DGDAL_USE_POSTGRESQL=ON \ - -DGDAL_USE_QHULL=ON \ - -DGDAL_USE_SQLITE3=ON \ - -DGDAL_USE_TIFF=ON \ - -DGDAL_USE_WEBP=ON \ - -DGDAL_USE_ZSTD=ON \ - \ - # OFF and Not working https://github.com/OSGeo/gdal/issues/7100 - # -DRENAME_INTERNAL_GEOTIFF_SYMBOLS=ON \ - -DGDAL_USE_ECW=OFF \ - -DGDAL_USE_GEOTIFF=OFF \ - -DGDAL_USE_HEIF=OFF \ - -DGDAL_USE_SPATIALITE=OFF \ - ; \ - fi \ - \ - && make -j$(nproc) \ - && make install \ - && cd / \ - && rm -fr /usr/src/gdal - -# Minimal command line test. -RUN set -ex \ - && ldconfig \ - && cs2cs \ - && ldd $(which gdalinfo) \ - && gdalinfo --version \ - && geos-config --version \ - && ogr2ogr --version \ - && proj \ - && sfcgal-config --version \ - && pcre-config --version - -# ------------------------------------------- -# STAGE final -# ------------------------------------------- -FROM postgres:16-bullseye - -ARG DOCKER_CMAKE_BUILD_TYPE -ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} - -RUN set -ex \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - curl \ - libboost-atomic1.74.0 \ - libboost-chrono1.74.0 \ - libboost-date-time1.74.0 \ - libboost-filesystem1.74.0 \ - libboost-program-options1.74.0 \ - libboost-serialization1.74.0 \ - libboost-system1.74.0 \ - libboost-test1.74.0 \ - libboost-thread1.74.0 \ - libboost-timer1.74.0 \ - libcurl3-gnutls \ - libexpat1 \ - libgmp10 \ - libgmpxx4ldbl \ - libjson-c5 \ - libmpfr6 \ - libpcre3 \ - libprotobuf-c1 \ - libtiff5 \ - libxml2 \ - sqlite3 \ - # gdal+ - libblosc1 \ - libcfitsio9 \ - libfreexl1 \ - libfyba0 \ - libhdf5-103-1 \ - libkmlbase1 \ - libkmldom1 \ - libkmlengine1 \ - libopenjp2-7 \ - libqhull-r8.0 \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=builder /_pgis*.* / -COPY --from=builder /usr/local /usr/local - -ARG CGAL_GIT_BRANCH -ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL5X_GIT_HASH 3c8e2053721271119499506ea1d8a49dee89e30c -ENV SFCGAL_GIT_HASH fc4dc5640e402c8b00426b5a3562324226725df9 -ENV PROJ_GIT_HASH d4ebd920c1e1ecd0e192790ab4fdb98c7b982176 -ENV GEOS_GIT_HASH 1033161eca3684e0d9479daeafd35a4e0fb1800e -ENV GDAL_GIT_HASH 43e51bc48e7d48795ae60731ddc1414611ec5d3e - -# Minimal command line test ( fail fast ) -RUN set -ex \ - && ldconfig \ - && cs2cs \ - && ldd $(which gdalinfo) \ - && gdalinfo --version \ - && gdal-config --formats \ - && geos-config --version \ - && ogr2ogr --version \ - && proj \ - && sfcgal-config --version \ - \ - # Testing ogr2ogr PostgreSQL driver. - && ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \ - || echo "ogr2ogr missing PostgreSQL driver" && exit 1 - -# install postgis -ENV POSTGIS_GIT_HASH d7b58458ea7cf8157d09f59e955820d3a4321892 - -RUN set -ex \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - autoconf \ - automake \ - autotools-dev \ - bison \ - build-essential \ - ca-certificates \ - cmake \ - docbook-xml \ - docbook5-xml \ - g++ \ - git \ - libboost-all-dev \ - libcunit1-dev \ - libcurl4-gnutls-dev \ - libgmp-dev \ - libjson-c-dev \ - libmpfr-dev \ - libpcre3-dev \ - libprotobuf-c-dev \ - libsqlite3-dev \ - libtiff-dev \ - libtool \ - libxml2-dev \ - libxml2-utils \ - make \ - pkg-config \ - postgresql-server-dev-$PG_MAJOR \ - protobuf-c-compiler \ - xsltproc \ - && cd \ - # postgis - && cd /usr/src/ \ - && git clone https://github.com/postgis/postgis.git \ - && cd postgis \ - && git checkout ${POSTGIS_GIT_HASH} \ - && git log -1 > /_pgis_last_commit.txt \ - && ./autogen.sh \ -# configure options taken from: -# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie - && ./configure \ - --enable-lto \ - && make -j$(nproc) \ - && make install \ -# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316 - && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ - && projsync --system-directory --file us_noaa_eshpgn \ - && projsync --system-directory --file us_noaa_prvi \ - && projsync --system-directory --file us_noaa_wmhpgn \ -# regress check - && mkdir /tempdb \ - && chown -R postgres:postgres /tempdb \ - && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ - && ldconfig \ - && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ - \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ - && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ - \ - && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ - && rm -rf /tempdb \ - && rm -rf /tmp/logfile \ - && rm -rf /tmp/pgis_reg \ -# clean - && cd / \ - && rm -rf /usr/src/postgis \ - && apt-get purge -y --autoremove \ - autoconf \ - automake \ - autotools-dev \ - bison \ - build-essential \ - cmake \ - docbook-xml \ - docbook5-xml \ - g++ \ - git \ - libboost-all-dev \ - libcurl4-gnutls-dev \ - libgmp-dev \ - libjson-c-dev \ - libmpfr-dev \ - libpcre3-dev \ - libprotobuf-c-dev \ - libsqlite3-dev \ - libtiff-dev \ - libtool \ - libxml2-dev \ - libxml2-utils \ - make \ - pkg-config \ - postgresql-server-dev-$PG_MAJOR \ - protobuf-c-compiler \ - xsltproc \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -RUN mkdir -p /docker-entrypoint-initdb.d -COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh -COPY ./update-postgis.sh /usr/local/bin - -# last final test -RUN set -ex \ - && ldconfig \ - && cs2cs \ - && ldd $(which gdalinfo) \ - && gdalinfo --version \ - && gdal-config --formats \ - && geos-config --version \ - && ogr2ogr --version \ - && proj \ - && sfcgal-config --version \ - \ - # Is the "ca-certificates" package installed? (for accessing remote raster files) - # https://github.com/postgis/docker-postgis/issues/307 - && dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \ - \ - # list last commits. - && find /_pgis_*_last_commit.txt -type f -print -exec cat {} \; \ - # list postgresql, postgis version - && cat _pgis_full_version.txt diff --git a/16-master/bookworm/Dockerfile b/16-master/bookworm/Dockerfile new file mode 100644 index 00000000..57973a8b --- /dev/null +++ b/16-master/bookworm/Dockerfile @@ -0,0 +1,730 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.master.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +# "Experimental"; solely for testing purposes. Anticipate frequent changes! +# This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05. + +ARG PGIS1_BASE_IMAGE=postgres:16-bookworm + +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_GEOS_REPOSITORY=https://github.com/libgeos/geos.git +ARG PGIS1_GDAL_REPOSITORY=https://github.com/OSGeo/gdal.git +ARG PGIS1_PROJ_REPOSITORY=https://github.com/OSGeo/PROJ.git +ARG PGIS1_SFCGAL_REPOSITORY=https://gitlab.com/sfcgal/SFCGAL.git +ARG PGIS1_CGAL_REPOSITORY=https://github.com/CGAL/cgal.git + +# Should valid git checkout ( SHA1, tags, branches ) +ARG PGIS1_POSTGIS_CHECKOUT=master +ARG PGIS1_GEOS_CHECKOUT=main +ARG PGIS1_GDAL_CHECKOUT=master +ARG PGIS1_PROJ_CHECKOUT=master +ARG PGIS1_SFCGAL_CHECKOUT=master +ARG PGIS1_CGAL_CHECKOUT=master + +# Skip SHA1 check if PGIS1_*_CHECKOUT_SHA1 is empty or 'nocheck' +# Otherwise, verify that the commit hash matches +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=nocheck +ARG PGIS1_GEOS_CHECKOUT_SHA1=nocheck +ARG PGIS1_GDAL_CHECKOUT_SHA1=nocheck +ARG PGIS1_PROJ_CHECKOUT_SHA1=nocheck +ARG PGIS1_SFCGAL_CHECKOUT_SHA1=nocheck +ARG PGIS1_CGAL_CHECKOUT_SHA1=nocheck + +ARG PGIS1_BOOST_VERSION=1.74.0 +ARG PGIS1_CMAKE_BUILD_TYPE=Release + +ARG PGIS1_GDAL_BUILD=with_extra +# Full GDAL build ; with arrow, parquet and extra dependencies + +FROM ${PGIS1_BASE_IMAGE} as builder + +WORKDIR / + +ARG PGIS1_BOOST_VERSION +ENV PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +# apt-get install +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + # build dependency + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libpq-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + make \ + pkg-config \ + protobuf-c-compiler \ + xsltproc \ + # gdal+ + liblz4-dev \ + liblzma-dev \ + libwebp-dev \ + libzstd-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ARG PGIS1_CMAKE_BUILD_TYPE +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} + +FROM builder as cgal-sfcgal-builder + +# cgal & sfcgal +ARG PGIS1_SFCGAL_REPOSITORY +ENV PGIS1_SFCGAL_REPOSITORY ${PGIS1_SFCGAL_REPOSITORY} +ARG PGIS1_SFCGAL_CHECKOUT +ENV PGIS1_SFCGAL_CHECKOUT ${PGIS1_SFCGAL_CHECKOUT} +ARG PGIS1_SFCGAL_CHECKOUT_SHA1 + +ARG PGIS1_CGAL_REPOSITORY +ENV PGIS1_CGAL_REPOSITORY ${PGIS1_CGAL_REPOSITORY} +ARG PGIS1_CGAL_CHECKOUT +ENV PGIS1_CGAL_CHECKOUT ${PGIS1_CGAL_CHECKOUT} +ARG PGIS1_CGAL_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir cgal \ + && cd cgal \ + && git init \ + && git remote add origin ${PGIS1_CGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_CGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_CGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_CGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_CGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_CGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping CGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_CGAL_CHECKOUT_SHA1}" ]; then \ + echo "CGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_cgal_last_commit.txt \ + && cd /usr/src \ + && mkdir SFCGAL \ + && cd SFCGAL \ + && git init \ + && git remote add origin ${PGIS1_SFCGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_SFCGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_SFCGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_SFCGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_SFCGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping SFCGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ]; then \ + echo "SFCGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_sfcgal_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. \ + -DCGAL_DIR=/usr/src/cgal \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DSFCGAL_BUILD_BENCH=OFF \ + -DSFCGAL_BUILD_EXAMPLES=OFF \ + -DSFCGAL_BUILD_TESTS=OFF \ + -DSFCGAL_WITH_OSG=OFF \ + && make -j$(nproc) \ + && make install \ + # clean + && rm -fr /usr/src/SFCGAL \ + && rm -fr /usr/src/cgal + + +FROM builder as proj-builder + +# proj +ARG PGIS1_PROJ_REPOSITORY +ENV PGIS1_PROJ_REPOSITORY ${PGIS1_PROJ_REPOSITORY} +ARG PGIS1_PROJ_CHECKOUT +ENV PGIS1_PROJ_CHECKOUT ${PGIS1_PROJ_CHECKOUT} +ARG PGIS1_PROJ_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir PROJ \ + && cd PROJ \ + && git init \ + && git remote add origin ${PGIS1_PROJ_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PROJ_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_PROJ_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_PROJ_CHECKOUT_SHA1 + && if [ -z "${PGIS1_PROJ_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_PROJ_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping PROJ SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_PROJ_CHECKOUT_SHA1}" ]; then \ + echo "PROJ SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_proj_last_commit.txt \ + # check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027 + && if [ -f "autogen.sh" ] ; then \ + set -eux \ + && echo "autotools version: 'autogen.sh' exists! Older version!" \ + && ./autogen.sh \ + && ./configure --disable-static \ + && make -j$(nproc) \ + && make install \ + ; \ + else \ + set -eux \ + && echo "cmake version: 'autogen.sh' does not exists! Newer version!" \ + && mkdir build \ + && cd build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + ; \ + fi \ + \ + && rm -fr /usr/src/PROJ + + +FROM builder as geos-builder + +# geos +ARG PGIS1_GEOS_REPOSITORY +ENV PGIS1_GEOS_REPOSITORY ${PGIS1_GEOS_REPOSITORY} +ARG PGIS1_GEOS_CHECKOUT +ENV PGIS1_GEOS_CHECKOUT ${PGIS1_GEOS_CHECKOUT} +ARG PGIS1_GEOS_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir geos \ + && cd geos \ + && git init \ + && git remote add origin ${PGIS1_GEOS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GEOS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GEOS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GEOS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GEOS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GEOS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GEOS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GEOS_CHECKOUT_SHA1}" ]; then \ + echo "GEOS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_geos_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/geos + + +FROM builder as stage0-builder + +COPY --from=cgal-sfcgal-builder /_pgis*.* / +COPY --from=cgal-sfcgal-builder /usr/local /usr/local + +COPY --from=proj-builder /_pgis*.* / +COPY --from=proj-builder /usr/local /usr/local + +COPY --from=geos-builder /_pgis*.* / +COPY --from=geos-builder /usr/local /usr/local +# gdal +ARG PGIS1_GDAL_REPOSITORY +ENV PGIS1_GDAL_REPOSITORY ${PGIS1_GDAL_REPOSITORY} +ARG PGIS1_GDAL_CHECKOUT +ENV PGIS1_GDAL_CHECKOUT ${PGIS1_GDAL_CHECKOUT} +ARG PGIS1_GDAL_CHECKOUT_SHA1 + + + +# Install Arrow C++ +# also check the "Build final image" section too, for the final installation +RUN set -eux \ + # add backports \ + && apt-get update \ + && apt install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get update \ + # Automatically determine the latest PGIS1 Arrow version and SOVERSION + && apt-cache showpkg libarrow-dev \ + && PGIS1_ARROW_VERSION=$(apt-cache showpkg libarrow-dev | grep -m1 'Versions:' -A1 | tail -n1 | grep -oP '^\S+') \ + && apt-cache depends libarrow-dev=${PGIS1_ARROW_VERSION} | tee /_pgis1_libarrow-dev-dependencies.txt \ + && PGIS1_ARROW_SOVERSION=$(grep 'Depends: libarrow' /_pgis1_libarrow-dev-dependencies.txt | grep -oP 'libarrow\K[0-9]+') \ + && echo "Detected PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" \ + && echo "Detected PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + # Backup the version variables - reusing in a later stage + && echo "PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" > /_pgis1_arrow_environment.env \ + && echo "PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" >> /_pgis1_arrow_environment.env \ + # Install Arrow C++ + && apt-get install -y --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + libarrow-dev=${PGIS1_ARROW_VERSION} \ + libparquet-dev=${PGIS1_ARROW_VERSION} \ + libarrow-acero-dev=${PGIS1_ARROW_VERSION} \ + libarrow-dataset-dev=${PGIS1_ARROW_VERSION} \ + \ + libblosc-dev \ + libcfitsio-dev \ + libfreexl-dev \ + libfyba-dev \ + libhdf5-dev \ + libheif-dev \ + libkml-dev \ + libnetcdf-dev \ + libopenjp2-7-dev \ + libpng-dev \ + libqhull-dev \ + libspatialite-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +## GDAL_build-end + +RUN set -eux \ + && ldconfig \ + && cd /usr/src \ + && mkdir gdal \ + && cd gdal \ + && git init \ + && git remote add origin ${PGIS1_GDAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GDAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GDAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GDAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GDAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GDAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GDAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GDAL_CHECKOUT_SHA1}" ]; then \ + echo "GDAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_gdal_last_commit.txt \ + \ + # gdal project directory structure - has been changed ! + && if [ -d "gdal" ] ; then \ + echo "Directory 'gdal' dir exists -> older version!" ; \ + cd gdal ; \ + else \ + echo "Directory 'gdal' does not exists! Newer version! " ; \ + fi \ + \ + && if [ -f "./autogen.sh" ]; then \ + # Building with autoconf ( old/deprecated ) + set -eux \ + && ./autogen.sh \ + && ./configure --disable-static \ + ; \ + else \ + # Building with cmake + set -eux \ + && mkdir build \ + && cd build \ + # config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules + && cmake .. \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DBUILD_TESTING=OFF \ + -DBUILD_DOCS=OFF \ + \ + -DGDAL_HIDE_INTERNAL_SYMBOLS=ON \ + -DRENAME_INTERNAL_TIFF_SYMBOLS=ON \ + -DGDAL_USE_CURL=ON \ + -DGDAL_USE_DEFLATE=ON \ + -DGDAL_USE_EXPAT=ON \ + -DGDAL_USE_GEOS=ON \ + -DGDAL_USE_JSONC=ON \ + -DGDAL_USE_LIBLZMA=ON \ + -DGDAL_USE_LIBXML2=ON \ + -DGDAL_USE_LZ4=ON \ + -DGDAL_USE_POSTGRESQL=ON \ + -DGDAL_USE_SQLITE3=ON \ + -DGDAL_USE_TIFF=ON \ + -DGDAL_USE_WEBP=ON \ + -DGDAL_USE_ZLIB=ON \ + -DGDAL_USE_ZSTD=ON \ + \ + -DGDAL_USE_ARROW=ON \ + -DGDAL_USE_ARROWDATASET=ON \ + -DGDAL_USE_BLOSC=ON \ + -DGDAL_USE_CFITSIO=ON \ + -DGDAL_USE_FREEXL=ON \ + -DGDAL_USE_FYBA=ON \ + -DGDAL_USE_HDF5=ON \ + -DGDAL_USE_HEIF=ON \ + -DGDAL_USE_LERC_INTERNAL=ON \ + -DGDAL_USE_LIBKML=ON \ + -DGDAL_USE_NETCDF=ON \ + -DGDAL_USE_OPENJPEG=ON \ + -DGDAL_USE_PARQUET=ON \ + -DGDAL_USE_PNG=ON \ + -DGDAL_USE_QHULL=ON \ + -DGDAL_USE_SPATIALITE=ON \ + ; \ + fi \ + \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/gdal + +# Minimal command line test. +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + && pcre-config --version + +# ------------------------------------------- +# final stage +# ------------------------------------------- +FROM ${PGIS1_BASE_IMAGE} + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS - 16-master spatial database extension with PostgreSQL 16 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ARG PGIS1_CMAKE_BUILD_TYPE +ARG PGIS1_BASE_IMAGE +ARG PGIS1_BOOST_VERSION + +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + PGIS1_BASE_IMAGE=${PGIS1_BASE_IMAGE} \ + PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +RUN set -eux \ + && apt-get update \ + && apt-get install -y -V --no-install-recommends \ + \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libpcre3 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=stage0-builder /_pgis*.* / +COPY --from=stage0-builder /usr/local /usr/local + +# Install Arrow + Parquet + other GDAL extra dependencies + +RUN set -eux \ + # Install Arrow + Parquet + && apt-get update \ + && apt-get install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get update \ + # Load the PGIS1_ARROW version variables + && . /_pgis1_arrow_environment.env \ + # Use the PGIS1_ARROW_SOVERSION as needed + && echo "Using PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + && apt-get install -y -V --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + \ + # Install GDAL extra dependencies + libblosc1 \ + libcrypto++8 \ + libfreexl1 \ + libfyba0 \ + libhdf5-103-1 \ + libheif1 \ + libkmlbase1 \ + libkmldom1 \ + libkmlengine1 \ + libnetcdf19 \ + libopenjp2-7 \ + libpng16-16 \ + libqhull-r8.0 \ + librasterlite2-1 \ + libspatialite7 \ + netcdf-bin \ + libcfitsio10 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + + +ARG PGIS1_GDAL_CHECKOUT +ARG PGIS1_GDAL_REPOSITORY +ARG PGIS1_GEOS_CHECKOUT +ARG PGIS1_GEOS_REPOSITORY +ARG PGIS1_PROJ_CHECKOUT +ARG PGIS1_PROJ_REPOSITORY +ARG PGIS1_SFCGAL_CHECKOUT +ARG PGIS1_SFCGAL_REPOSITORY +ARG PGIS1_CGAL_REPOSITORY +ARG PGIS1_CGAL_CHECKOUT + +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +ENV PGIS1_GDAL_CHECKOUT=${PGIS1_GDAL_CHECKOUT} \ + PGIS1_GDAL_REPOSITORY=${PGIS1_GDAL_REPOSITORY} \ + PGIS1_GEOS_CHECKOUT=${PGIS1_GEOS_CHECKOUT} \ + PGIS1_GEOS_REPOSITORY=${PGIS1_GEOS_REPOSITORY} \ + PGIS1_PROJ_CHECKOUT=${PGIS1_PROJ_CHECKOUT} \ + PGIS1_PROJ_REPOSITORY=${PGIS1_PROJ_REPOSITORY} \ + PGIS1_CGAL_CHECKOUT=${PGIS1_CGAL_CHECKOUT} \ + PGIS1_CGAL_REPOSITORY=${PGIS1_CGAL_REPOSITORY} \ + PGIS1_SFCGAL_CHECKOUT=${PGIS1_SFCGAL_CHECKOUT} \ + PGIS1_SFCGAL_REPOSITORY=${PGIS1_SFCGAL_REPOSITORY} \ + PGIS1_POSTGIS_CHECKOUT=${PGIS1_POSTGIS_CHECKOUT} \ + PGIS1_POSTGIS_REPOSITORY=${PGIS1_POSTGIS_REPOSITORY} + +# Minimal command line test ( fail fast ) +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + \ + # Testing ogr2ogr PostgreSQL driver. + && ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \ + || echo "ogr2ogr missing PostgreSQL driver" && exit 1 + +# Specify GDAL_CONFIG and LD_LIBRARY_PATH for PostGIS build; +# The arm64 build is very senitive. +ENV GDAL_CONFIG /usr/local/bin/gdal-config +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +# temporary workaround for : nitdb: invalid locale settings; check LANG and LC_* environment variables +# https://github.com/docker-library/postgres/issues/1112#issuecomment-1746076388 +RUN set -eux \ + && echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcunit1-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && cd \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_POSTGIS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_POSTGIS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_POSTGIS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping POSTGIS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ]; then \ + echo "POSTGIS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_last_commit.txt \ + && ldconfig \ + && ./autogen.sh \ +# configure options taken from: +# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ +# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316 + && if command -v projsync >/dev/null 2>&1; then \ + projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn ; \ + fi \ +# regress check + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && ldconfig \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# clean + && cd / \ + && rm -rf /usr/src/postgis \ + && apt-get purge -y --autoremove \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin + +# last final test +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + # check any missing dependencies + && ldd /usr/lib/postgresql/$PG_MAJOR/lib/*.so | grep 'not found' && exit 1 || true \ + \ + # Is the "ca-certificates" package installed? (for accessing remote raster files) + # https://github.com/postgis/docker-postgis/issues/307 + && dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \ + \ + # list last commits. + && find /_pgis*_commit.txt -type f -print -exec cat {} \; \ + # list postgresql, postgis version + && cat _pgis_full_version.txt diff --git a/16-master/bookworm/initdb-postgis.sh b/16-master/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-master/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-master/bookworm/tags b/16-master/bookworm/tags new file mode 100644 index 00000000..b9d1ddd8 --- /dev/null +++ b/16-master/bookworm/tags @@ -0,0 +1 @@ +16-master-bookworm 16-master diff --git a/16-master/bookworm/update-postgis.sh b/16-master/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-master/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/16-master/initdb-postgis.sh b/16-master/initdb-postgis.sh deleted file mode 100644 index e38ad7d6..00000000 --- a/16-master/initdb-postgis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; -EOSQL -done diff --git a/16-recent/bookworm/Dockerfile b/16-recent/bookworm/Dockerfile new file mode 100644 index 00000000..9c18177a --- /dev/null +++ b/16-recent/bookworm/Dockerfile @@ -0,0 +1,730 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.master.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +# "Experimental"; solely for testing purposes. Anticipate frequent changes! +# This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05. + +ARG PGIS1_BASE_IMAGE=postgres:16-bookworm + +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_GEOS_REPOSITORY=https://github.com/libgeos/geos.git +ARG PGIS1_GDAL_REPOSITORY=https://github.com/OSGeo/gdal.git +ARG PGIS1_PROJ_REPOSITORY=https://github.com/OSGeo/PROJ.git +ARG PGIS1_SFCGAL_REPOSITORY=https://gitlab.com/sfcgal/SFCGAL.git +ARG PGIS1_CGAL_REPOSITORY=https://github.com/CGAL/cgal.git + +# Should valid git checkout ( SHA1, tags, branches ) +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_GEOS_CHECKOUT=tags/3.13.0 +ARG PGIS1_GDAL_CHECKOUT=tags/v3.10.0 +ARG PGIS1_PROJ_CHECKOUT=tags/9.5.0 +ARG PGIS1_SFCGAL_CHECKOUT=tags/v2.0.0 +ARG PGIS1_CGAL_CHECKOUT=tags/v6.0.1 + +# Skip SHA1 check if PGIS1_*_CHECKOUT_SHA1 is empty or 'nocheck' +# Otherwise, verify that the commit hash matches +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 +ARG PGIS1_GEOS_CHECKOUT_SHA1=d7957246c588aa9c690efe67924fd70e741a06ab +ARG PGIS1_GDAL_CHECKOUT_SHA1=35a44cc570cdf4dbd55611e4bd61da76e56bc221 +ARG PGIS1_PROJ_CHECKOUT_SHA1=0a407325fbb5bf42407a7dc5d4f948be9707e302 +ARG PGIS1_SFCGAL_CHECKOUT_SHA1=5d4eb5e896c41e592534ba1e79ccc721c66d66e3 +ARG PGIS1_CGAL_CHECKOUT_SHA1=50cfbde3b84dbeae8338268db2d78fe4fcb522de + +ARG PGIS1_BOOST_VERSION=1.74.0 +ARG PGIS1_CMAKE_BUILD_TYPE=Release + +ARG PGIS1_GDAL_BUILD=with_extra +# Full GDAL build ; with arrow, parquet and extra dependencies + +FROM ${PGIS1_BASE_IMAGE} as builder + +WORKDIR / + +ARG PGIS1_BOOST_VERSION +ENV PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +# apt-get install +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + # build dependency + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libpq-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + make \ + pkg-config \ + protobuf-c-compiler \ + xsltproc \ + # gdal+ + liblz4-dev \ + liblzma-dev \ + libwebp-dev \ + libzstd-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ARG PGIS1_CMAKE_BUILD_TYPE +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} + +FROM builder as cgal-sfcgal-builder + +# cgal & sfcgal +ARG PGIS1_SFCGAL_REPOSITORY +ENV PGIS1_SFCGAL_REPOSITORY ${PGIS1_SFCGAL_REPOSITORY} +ARG PGIS1_SFCGAL_CHECKOUT +ENV PGIS1_SFCGAL_CHECKOUT ${PGIS1_SFCGAL_CHECKOUT} +ARG PGIS1_SFCGAL_CHECKOUT_SHA1 + +ARG PGIS1_CGAL_REPOSITORY +ENV PGIS1_CGAL_REPOSITORY ${PGIS1_CGAL_REPOSITORY} +ARG PGIS1_CGAL_CHECKOUT +ENV PGIS1_CGAL_CHECKOUT ${PGIS1_CGAL_CHECKOUT} +ARG PGIS1_CGAL_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir cgal \ + && cd cgal \ + && git init \ + && git remote add origin ${PGIS1_CGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_CGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_CGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_CGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_CGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_CGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping CGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_CGAL_CHECKOUT_SHA1}" ]; then \ + echo "CGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_cgal_last_commit.txt \ + && cd /usr/src \ + && mkdir SFCGAL \ + && cd SFCGAL \ + && git init \ + && git remote add origin ${PGIS1_SFCGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_SFCGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_SFCGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_SFCGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_SFCGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping SFCGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ]; then \ + echo "SFCGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_sfcgal_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. \ + -DCGAL_DIR=/usr/src/cgal \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DSFCGAL_BUILD_BENCH=OFF \ + -DSFCGAL_BUILD_EXAMPLES=OFF \ + -DSFCGAL_BUILD_TESTS=OFF \ + -DSFCGAL_WITH_OSG=OFF \ + && make -j$(nproc) \ + && make install \ + # clean + && rm -fr /usr/src/SFCGAL \ + && rm -fr /usr/src/cgal + + +FROM builder as proj-builder + +# proj +ARG PGIS1_PROJ_REPOSITORY +ENV PGIS1_PROJ_REPOSITORY ${PGIS1_PROJ_REPOSITORY} +ARG PGIS1_PROJ_CHECKOUT +ENV PGIS1_PROJ_CHECKOUT ${PGIS1_PROJ_CHECKOUT} +ARG PGIS1_PROJ_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir PROJ \ + && cd PROJ \ + && git init \ + && git remote add origin ${PGIS1_PROJ_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PROJ_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_PROJ_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_PROJ_CHECKOUT_SHA1 + && if [ -z "${PGIS1_PROJ_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_PROJ_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping PROJ SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_PROJ_CHECKOUT_SHA1}" ]; then \ + echo "PROJ SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_proj_last_commit.txt \ + # check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027 + && if [ -f "autogen.sh" ] ; then \ + set -eux \ + && echo "autotools version: 'autogen.sh' exists! Older version!" \ + && ./autogen.sh \ + && ./configure --disable-static \ + && make -j$(nproc) \ + && make install \ + ; \ + else \ + set -eux \ + && echo "cmake version: 'autogen.sh' does not exists! Newer version!" \ + && mkdir build \ + && cd build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + ; \ + fi \ + \ + && rm -fr /usr/src/PROJ + + +FROM builder as geos-builder + +# geos +ARG PGIS1_GEOS_REPOSITORY +ENV PGIS1_GEOS_REPOSITORY ${PGIS1_GEOS_REPOSITORY} +ARG PGIS1_GEOS_CHECKOUT +ENV PGIS1_GEOS_CHECKOUT ${PGIS1_GEOS_CHECKOUT} +ARG PGIS1_GEOS_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir geos \ + && cd geos \ + && git init \ + && git remote add origin ${PGIS1_GEOS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GEOS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GEOS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GEOS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GEOS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GEOS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GEOS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GEOS_CHECKOUT_SHA1}" ]; then \ + echo "GEOS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_geos_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/geos + + +FROM builder as stage0-builder + +COPY --from=cgal-sfcgal-builder /_pgis*.* / +COPY --from=cgal-sfcgal-builder /usr/local /usr/local + +COPY --from=proj-builder /_pgis*.* / +COPY --from=proj-builder /usr/local /usr/local + +COPY --from=geos-builder /_pgis*.* / +COPY --from=geos-builder /usr/local /usr/local +# gdal +ARG PGIS1_GDAL_REPOSITORY +ENV PGIS1_GDAL_REPOSITORY ${PGIS1_GDAL_REPOSITORY} +ARG PGIS1_GDAL_CHECKOUT +ENV PGIS1_GDAL_CHECKOUT ${PGIS1_GDAL_CHECKOUT} +ARG PGIS1_GDAL_CHECKOUT_SHA1 + + + +# Install Arrow C++ +# also check the "Build final image" section too, for the final installation +RUN set -eux \ + # add backports \ + && apt-get update \ + && apt install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get update \ + # Automatically determine the latest PGIS1 Arrow version and SOVERSION + && apt-cache showpkg libarrow-dev \ + && PGIS1_ARROW_VERSION=$(apt-cache showpkg libarrow-dev | grep -m1 'Versions:' -A1 | tail -n1 | grep -oP '^\S+') \ + && apt-cache depends libarrow-dev=${PGIS1_ARROW_VERSION} | tee /_pgis1_libarrow-dev-dependencies.txt \ + && PGIS1_ARROW_SOVERSION=$(grep 'Depends: libarrow' /_pgis1_libarrow-dev-dependencies.txt | grep -oP 'libarrow\K[0-9]+') \ + && echo "Detected PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" \ + && echo "Detected PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + # Backup the version variables - reusing in a later stage + && echo "PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" > /_pgis1_arrow_environment.env \ + && echo "PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" >> /_pgis1_arrow_environment.env \ + # Install Arrow C++ + && apt-get install -y --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + libarrow-dev=${PGIS1_ARROW_VERSION} \ + libparquet-dev=${PGIS1_ARROW_VERSION} \ + libarrow-acero-dev=${PGIS1_ARROW_VERSION} \ + libarrow-dataset-dev=${PGIS1_ARROW_VERSION} \ + \ + libblosc-dev \ + libcfitsio-dev \ + libfreexl-dev \ + libfyba-dev \ + libhdf5-dev \ + libheif-dev \ + libkml-dev \ + libnetcdf-dev \ + libopenjp2-7-dev \ + libpng-dev \ + libqhull-dev \ + libspatialite-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +## GDAL_build-end + +RUN set -eux \ + && ldconfig \ + && cd /usr/src \ + && mkdir gdal \ + && cd gdal \ + && git init \ + && git remote add origin ${PGIS1_GDAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GDAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GDAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GDAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GDAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GDAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GDAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GDAL_CHECKOUT_SHA1}" ]; then \ + echo "GDAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_gdal_last_commit.txt \ + \ + # gdal project directory structure - has been changed ! + && if [ -d "gdal" ] ; then \ + echo "Directory 'gdal' dir exists -> older version!" ; \ + cd gdal ; \ + else \ + echo "Directory 'gdal' does not exists! Newer version! " ; \ + fi \ + \ + && if [ -f "./autogen.sh" ]; then \ + # Building with autoconf ( old/deprecated ) + set -eux \ + && ./autogen.sh \ + && ./configure --disable-static \ + ; \ + else \ + # Building with cmake + set -eux \ + && mkdir build \ + && cd build \ + # config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules + && cmake .. \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DBUILD_TESTING=OFF \ + -DBUILD_DOCS=OFF \ + \ + -DGDAL_HIDE_INTERNAL_SYMBOLS=ON \ + -DRENAME_INTERNAL_TIFF_SYMBOLS=ON \ + -DGDAL_USE_CURL=ON \ + -DGDAL_USE_DEFLATE=ON \ + -DGDAL_USE_EXPAT=ON \ + -DGDAL_USE_GEOS=ON \ + -DGDAL_USE_JSONC=ON \ + -DGDAL_USE_LIBLZMA=ON \ + -DGDAL_USE_LIBXML2=ON \ + -DGDAL_USE_LZ4=ON \ + -DGDAL_USE_POSTGRESQL=ON \ + -DGDAL_USE_SQLITE3=ON \ + -DGDAL_USE_TIFF=ON \ + -DGDAL_USE_WEBP=ON \ + -DGDAL_USE_ZLIB=ON \ + -DGDAL_USE_ZSTD=ON \ + \ + -DGDAL_USE_ARROW=ON \ + -DGDAL_USE_ARROWDATASET=ON \ + -DGDAL_USE_BLOSC=ON \ + -DGDAL_USE_CFITSIO=ON \ + -DGDAL_USE_FREEXL=ON \ + -DGDAL_USE_FYBA=ON \ + -DGDAL_USE_HDF5=ON \ + -DGDAL_USE_HEIF=ON \ + -DGDAL_USE_LERC_INTERNAL=ON \ + -DGDAL_USE_LIBKML=ON \ + -DGDAL_USE_NETCDF=ON \ + -DGDAL_USE_OPENJPEG=ON \ + -DGDAL_USE_PARQUET=ON \ + -DGDAL_USE_PNG=ON \ + -DGDAL_USE_QHULL=ON \ + -DGDAL_USE_SPATIALITE=ON \ + ; \ + fi \ + \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/gdal + +# Minimal command line test. +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + && pcre-config --version + +# ------------------------------------------- +# final stage +# ------------------------------------------- +FROM ${PGIS1_BASE_IMAGE} + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS - 16-recent spatial database extension with PostgreSQL 16 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ARG PGIS1_CMAKE_BUILD_TYPE +ARG PGIS1_BASE_IMAGE +ARG PGIS1_BOOST_VERSION + +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + PGIS1_BASE_IMAGE=${PGIS1_BASE_IMAGE} \ + PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +RUN set -eux \ + && apt-get update \ + && apt-get install -y -V --no-install-recommends \ + \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libpcre3 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=stage0-builder /_pgis*.* / +COPY --from=stage0-builder /usr/local /usr/local + +# Install Arrow + Parquet + other GDAL extra dependencies + +RUN set -eux \ + # Install Arrow + Parquet + && apt-get update \ + && apt-get install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get update \ + # Load the PGIS1_ARROW version variables + && . /_pgis1_arrow_environment.env \ + # Use the PGIS1_ARROW_SOVERSION as needed + && echo "Using PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + && apt-get install -y -V --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + \ + # Install GDAL extra dependencies + libblosc1 \ + libcrypto++8 \ + libfreexl1 \ + libfyba0 \ + libhdf5-103-1 \ + libheif1 \ + libkmlbase1 \ + libkmldom1 \ + libkmlengine1 \ + libnetcdf19 \ + libopenjp2-7 \ + libpng16-16 \ + libqhull-r8.0 \ + librasterlite2-1 \ + libspatialite7 \ + netcdf-bin \ + libcfitsio10 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + + +ARG PGIS1_GDAL_CHECKOUT +ARG PGIS1_GDAL_REPOSITORY +ARG PGIS1_GEOS_CHECKOUT +ARG PGIS1_GEOS_REPOSITORY +ARG PGIS1_PROJ_CHECKOUT +ARG PGIS1_PROJ_REPOSITORY +ARG PGIS1_SFCGAL_CHECKOUT +ARG PGIS1_SFCGAL_REPOSITORY +ARG PGIS1_CGAL_REPOSITORY +ARG PGIS1_CGAL_CHECKOUT + +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +ENV PGIS1_GDAL_CHECKOUT=${PGIS1_GDAL_CHECKOUT} \ + PGIS1_GDAL_REPOSITORY=${PGIS1_GDAL_REPOSITORY} \ + PGIS1_GEOS_CHECKOUT=${PGIS1_GEOS_CHECKOUT} \ + PGIS1_GEOS_REPOSITORY=${PGIS1_GEOS_REPOSITORY} \ + PGIS1_PROJ_CHECKOUT=${PGIS1_PROJ_CHECKOUT} \ + PGIS1_PROJ_REPOSITORY=${PGIS1_PROJ_REPOSITORY} \ + PGIS1_CGAL_CHECKOUT=${PGIS1_CGAL_CHECKOUT} \ + PGIS1_CGAL_REPOSITORY=${PGIS1_CGAL_REPOSITORY} \ + PGIS1_SFCGAL_CHECKOUT=${PGIS1_SFCGAL_CHECKOUT} \ + PGIS1_SFCGAL_REPOSITORY=${PGIS1_SFCGAL_REPOSITORY} \ + PGIS1_POSTGIS_CHECKOUT=${PGIS1_POSTGIS_CHECKOUT} \ + PGIS1_POSTGIS_REPOSITORY=${PGIS1_POSTGIS_REPOSITORY} + +# Minimal command line test ( fail fast ) +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + \ + # Testing ogr2ogr PostgreSQL driver. + && ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \ + || echo "ogr2ogr missing PostgreSQL driver" && exit 1 + +# Specify GDAL_CONFIG and LD_LIBRARY_PATH for PostGIS build; +# The arm64 build is very senitive. +ENV GDAL_CONFIG /usr/local/bin/gdal-config +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +# temporary workaround for : nitdb: invalid locale settings; check LANG and LC_* environment variables +# https://github.com/docker-library/postgres/issues/1112#issuecomment-1746076388 +RUN set -eux \ + && echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcunit1-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && cd \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_POSTGIS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_POSTGIS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_POSTGIS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping POSTGIS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ]; then \ + echo "POSTGIS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_last_commit.txt \ + && ldconfig \ + && ./autogen.sh \ +# configure options taken from: +# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ +# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316 + && if command -v projsync >/dev/null 2>&1; then \ + projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn ; \ + fi \ +# regress check + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && ldconfig \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# clean + && cd / \ + && rm -rf /usr/src/postgis \ + && apt-get purge -y --autoremove \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin + +# last final test +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + # check any missing dependencies + && ldd /usr/lib/postgresql/$PG_MAJOR/lib/*.so | grep 'not found' && exit 1 || true \ + \ + # Is the "ca-certificates" package installed? (for accessing remote raster files) + # https://github.com/postgis/docker-postgis/issues/307 + && dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \ + \ + # list last commits. + && find /_pgis*_commit.txt -type f -print -exec cat {} \; \ + # list postgresql, postgis version + && cat _pgis_full_version.txt diff --git a/16-recent/bookworm/initdb-postgis.sh b/16-recent/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/16-recent/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/16-recent/bookworm/tags b/16-recent/bookworm/tags new file mode 100644 index 00000000..1d697270 --- /dev/null +++ b/16-recent/bookworm/tags @@ -0,0 +1 @@ +16-recent-bookworm 16-recent-postgis3.5.0-geos3.13.0-proj9.5.0-gdal3.10.0-cgal6.0.1-sfcgal2.0.0-bookworm 16-recent-postgis3.5-geos3.13-proj9.5-gdal3.10-cgal6.0-sfcgal2.0-bookworm 16-recent diff --git a/16-recent/bookworm/update-postgis.sh b/16-recent/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/16-recent/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/17-3.4/alpine3.20/Dockerfile b/17-3.4/alpine3.20/Dockerfile new file mode 100644 index 00000000..fcc34ce0 --- /dev/null +++ b/17-3.4/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:17-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.4.3 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=e36594574671877ca6178c944e6d430f87f310bf + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 17 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/17-3.4/alpine3.20/initdb-postgis.sh b/17-3.4/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/17-3.4/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/17-3.4/alpine3.20/tags b/17-3.4/alpine3.20/tags new file mode 100644 index 00000000..a5e397b9 --- /dev/null +++ b/17-3.4/alpine3.20/tags @@ -0,0 +1 @@ +17-3.4-alpine3.20 17-3.4.3-alpine3.20 17-3.4-alpine diff --git a/17-3.4/alpine3.20/update-postgis.sh b/17-3.4/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/17-3.4/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/17-3.5/alpine3.19/Dockerfile b/17-3.5/alpine3.19/Dockerfile new file mode 100644 index 00000000..30583cdc --- /dev/null +++ b/17-3.5/alpine3.19/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:17-alpine3.19 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 17 alpine3.19" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/17-3.5/alpine3.19/initdb-postgis.sh b/17-3.5/alpine3.19/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/17-3.5/alpine3.19/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/17-3.5/alpine3.19/tags b/17-3.5/alpine3.19/tags new file mode 100644 index 00000000..64852a2e --- /dev/null +++ b/17-3.5/alpine3.19/tags @@ -0,0 +1 @@ +17-3.5-alpine3.19 17-3.5.0-alpine3.19 diff --git a/17-3.5/alpine3.19/update-postgis.sh b/17-3.5/alpine3.19/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/17-3.5/alpine3.19/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/17-3.5/alpine3.20/Dockerfile b/17-3.5/alpine3.20/Dockerfile new file mode 100644 index 00000000..1632abba --- /dev/null +++ b/17-3.5/alpine3.20/Dockerfile @@ -0,0 +1,140 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.alpine.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +ARG PGIS1_BASE_IMAGE=postgres:17-alpine3.20 +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL 17 alpine3.20" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +RUN set -eux \ + && apk add --no-cache --virtual .build-deps \ + \ + ca-certificates \ + gdal-dev \ + geos-dev \ + proj-dev \ + proj-util \ + sfcgal-dev \ + \ + # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains + # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. + # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 + $DOCKER_PG_LLVM_DEPS \ + \ + autoconf \ + automake \ + bison \ + cunit-dev \ + file \ + g++ \ + gcc \ + gettext-dev \ + git \ + json-c-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ + perl \ + protobuf-c-dev \ + \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ +# build PostGIS - with Link Time Optimization (LTO) enabled + && cd /usr/src/postgis \ + && gettextize \ + && ./autogen.sh \ + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ + \ +# This section is for refreshing the proj data for the regression tests. +# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 +# This increases the Docker image size by about 1 MB. + && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn \ +# This section performs a regression check. + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# add .postgis-rundeps + && apk add --no-cache --virtual .postgis-rundeps \ + \ + gdal \ + geos \ + proj \ + sfcgal \ + \ + json-c \ + libstdc++ \ + pcre \ + protobuf-c \ + \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ + # ca-certificates: for accessing remote raster files + # fix https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ +# clean + && cd / \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ +# At the end of the build, we print the collected information +# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. + && cat /_pgis_full_version.txt + +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/17-3.5/alpine3.20/initdb-postgis.sh b/17-3.5/alpine3.20/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/17-3.5/alpine3.20/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/17-3.5/alpine3.20/tags b/17-3.5/alpine3.20/tags new file mode 100644 index 00000000..407558ff --- /dev/null +++ b/17-3.5/alpine3.20/tags @@ -0,0 +1 @@ +17-3.5-alpine3.20 17-3.5.0-alpine3.20 17-3.5-alpine alpine diff --git a/17-3.5/alpine3.20/update-postgis.sh b/17-3.5/alpine3.20/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/17-3.5/alpine3.20/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/17-3.5/bookworm/Dockerfile b/17-3.5/bookworm/Dockerfile new file mode 100644 index 00000000..6617b1b1 --- /dev/null +++ b/17-3.5/bookworm/Dockerfile @@ -0,0 +1,39 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM postgres:17-bookworm + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg120+1 spatial database extension with PostgreSQL 17 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ENV POSTGIS_MAJOR 3 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg120+1 + +RUN set -eux \ + && apt-get update \ + && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ + && apt-get install -y --no-install-recommends \ + # ca-certificates: for accessing remote raster files; + # fix: https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ + \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ + && rm -rf /var/lib/apt/lists/* + +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/17-3.5/bookworm/initdb-postgis.sh b/17-3.5/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/17-3.5/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/17-3.5/bookworm/tags b/17-3.5/bookworm/tags new file mode 100644 index 00000000..6df75ab5 --- /dev/null +++ b/17-3.5/bookworm/tags @@ -0,0 +1 @@ +17-3.5-bookworm 17-3.5.0-bookworm 17-3.5 latest diff --git a/17-3.5/bookworm/update-postgis.sh b/17-3.5/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/17-3.5/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/11-3.3/Dockerfile b/17-3.5/bullseye/Dockerfile similarity index 54% rename from 11-3.3/Dockerfile rename to 17-3.5/bullseye/Dockerfile index b09cd77e..fd4813a1 100644 --- a/11-3.3/Dockerfile +++ b/17-3.5/bullseye/Dockerfile @@ -1,17 +1,19 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.debian.template" +# PLEASE DO NOT EDIT IT DIRECTLY. # - -FROM postgres:11-bullseye +FROM postgres:17-bullseye LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.3.4+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 11 bullseye" \ + org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 17 bullseye" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR 3 -ENV POSTGIS_VERSION 3.3.4+dfsg-1.pgdg110+1 +ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1 -RUN apt-get update \ +RUN set -eux \ + && apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; @@ -20,9 +22,18 @@ RUN apt-get update \ \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgis \ && rm -rf /var/lib/apt/lists/* +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + RUN mkdir -p /docker-entrypoint-initdb.d COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh COPY ./update-postgis.sh /usr/local/bin - diff --git a/17-3.5/bullseye/initdb-postgis.sh b/17-3.5/bullseye/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/17-3.5/bullseye/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/17-3.5/bullseye/tags b/17-3.5/bullseye/tags new file mode 100644 index 00000000..776d51be --- /dev/null +++ b/17-3.5/bullseye/tags @@ -0,0 +1 @@ +17-3.5-bullseye 17-3.5.0-bullseye diff --git a/17-3.5/bullseye/update-postgis.sh b/17-3.5/bullseye/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/17-3.5/bullseye/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/17-master/bookworm/Dockerfile b/17-master/bookworm/Dockerfile new file mode 100644 index 00000000..030daa58 --- /dev/null +++ b/17-master/bookworm/Dockerfile @@ -0,0 +1,730 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.master.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +# "Experimental"; solely for testing purposes. Anticipate frequent changes! +# This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05. + +ARG PGIS1_BASE_IMAGE=postgres:17-bookworm + +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_GEOS_REPOSITORY=https://github.com/libgeos/geos.git +ARG PGIS1_GDAL_REPOSITORY=https://github.com/OSGeo/gdal.git +ARG PGIS1_PROJ_REPOSITORY=https://github.com/OSGeo/PROJ.git +ARG PGIS1_SFCGAL_REPOSITORY=https://gitlab.com/sfcgal/SFCGAL.git +ARG PGIS1_CGAL_REPOSITORY=https://github.com/CGAL/cgal.git + +# Should valid git checkout ( SHA1, tags, branches ) +ARG PGIS1_POSTGIS_CHECKOUT=master +ARG PGIS1_GEOS_CHECKOUT=main +ARG PGIS1_GDAL_CHECKOUT=master +ARG PGIS1_PROJ_CHECKOUT=master +ARG PGIS1_SFCGAL_CHECKOUT=master +ARG PGIS1_CGAL_CHECKOUT=master + +# Skip SHA1 check if PGIS1_*_CHECKOUT_SHA1 is empty or 'nocheck' +# Otherwise, verify that the commit hash matches +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=nocheck +ARG PGIS1_GEOS_CHECKOUT_SHA1=nocheck +ARG PGIS1_GDAL_CHECKOUT_SHA1=nocheck +ARG PGIS1_PROJ_CHECKOUT_SHA1=nocheck +ARG PGIS1_SFCGAL_CHECKOUT_SHA1=nocheck +ARG PGIS1_CGAL_CHECKOUT_SHA1=nocheck + +ARG PGIS1_BOOST_VERSION=1.74.0 +ARG PGIS1_CMAKE_BUILD_TYPE=Release + +ARG PGIS1_GDAL_BUILD=with_extra +# Full GDAL build ; with arrow, parquet and extra dependencies + +FROM ${PGIS1_BASE_IMAGE} as builder + +WORKDIR / + +ARG PGIS1_BOOST_VERSION +ENV PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +# apt-get install +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + # build dependency + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libpq-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + make \ + pkg-config \ + protobuf-c-compiler \ + xsltproc \ + # gdal+ + liblz4-dev \ + liblzma-dev \ + libwebp-dev \ + libzstd-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ARG PGIS1_CMAKE_BUILD_TYPE +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} + +FROM builder as cgal-sfcgal-builder + +# cgal & sfcgal +ARG PGIS1_SFCGAL_REPOSITORY +ENV PGIS1_SFCGAL_REPOSITORY ${PGIS1_SFCGAL_REPOSITORY} +ARG PGIS1_SFCGAL_CHECKOUT +ENV PGIS1_SFCGAL_CHECKOUT ${PGIS1_SFCGAL_CHECKOUT} +ARG PGIS1_SFCGAL_CHECKOUT_SHA1 + +ARG PGIS1_CGAL_REPOSITORY +ENV PGIS1_CGAL_REPOSITORY ${PGIS1_CGAL_REPOSITORY} +ARG PGIS1_CGAL_CHECKOUT +ENV PGIS1_CGAL_CHECKOUT ${PGIS1_CGAL_CHECKOUT} +ARG PGIS1_CGAL_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir cgal \ + && cd cgal \ + && git init \ + && git remote add origin ${PGIS1_CGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_CGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_CGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_CGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_CGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_CGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping CGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_CGAL_CHECKOUT_SHA1}" ]; then \ + echo "CGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_cgal_last_commit.txt \ + && cd /usr/src \ + && mkdir SFCGAL \ + && cd SFCGAL \ + && git init \ + && git remote add origin ${PGIS1_SFCGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_SFCGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_SFCGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_SFCGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_SFCGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping SFCGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ]; then \ + echo "SFCGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_sfcgal_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. \ + -DCGAL_DIR=/usr/src/cgal \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DSFCGAL_BUILD_BENCH=OFF \ + -DSFCGAL_BUILD_EXAMPLES=OFF \ + -DSFCGAL_BUILD_TESTS=OFF \ + -DSFCGAL_WITH_OSG=OFF \ + && make -j$(nproc) \ + && make install \ + # clean + && rm -fr /usr/src/SFCGAL \ + && rm -fr /usr/src/cgal + + +FROM builder as proj-builder + +# proj +ARG PGIS1_PROJ_REPOSITORY +ENV PGIS1_PROJ_REPOSITORY ${PGIS1_PROJ_REPOSITORY} +ARG PGIS1_PROJ_CHECKOUT +ENV PGIS1_PROJ_CHECKOUT ${PGIS1_PROJ_CHECKOUT} +ARG PGIS1_PROJ_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir PROJ \ + && cd PROJ \ + && git init \ + && git remote add origin ${PGIS1_PROJ_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PROJ_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_PROJ_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_PROJ_CHECKOUT_SHA1 + && if [ -z "${PGIS1_PROJ_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_PROJ_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping PROJ SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_PROJ_CHECKOUT_SHA1}" ]; then \ + echo "PROJ SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_proj_last_commit.txt \ + # check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027 + && if [ -f "autogen.sh" ] ; then \ + set -eux \ + && echo "autotools version: 'autogen.sh' exists! Older version!" \ + && ./autogen.sh \ + && ./configure --disable-static \ + && make -j$(nproc) \ + && make install \ + ; \ + else \ + set -eux \ + && echo "cmake version: 'autogen.sh' does not exists! Newer version!" \ + && mkdir build \ + && cd build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + ; \ + fi \ + \ + && rm -fr /usr/src/PROJ + + +FROM builder as geos-builder + +# geos +ARG PGIS1_GEOS_REPOSITORY +ENV PGIS1_GEOS_REPOSITORY ${PGIS1_GEOS_REPOSITORY} +ARG PGIS1_GEOS_CHECKOUT +ENV PGIS1_GEOS_CHECKOUT ${PGIS1_GEOS_CHECKOUT} +ARG PGIS1_GEOS_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir geos \ + && cd geos \ + && git init \ + && git remote add origin ${PGIS1_GEOS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GEOS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GEOS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GEOS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GEOS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GEOS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GEOS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GEOS_CHECKOUT_SHA1}" ]; then \ + echo "GEOS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_geos_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/geos + + +FROM builder as stage0-builder + +COPY --from=cgal-sfcgal-builder /_pgis*.* / +COPY --from=cgal-sfcgal-builder /usr/local /usr/local + +COPY --from=proj-builder /_pgis*.* / +COPY --from=proj-builder /usr/local /usr/local + +COPY --from=geos-builder /_pgis*.* / +COPY --from=geos-builder /usr/local /usr/local +# gdal +ARG PGIS1_GDAL_REPOSITORY +ENV PGIS1_GDAL_REPOSITORY ${PGIS1_GDAL_REPOSITORY} +ARG PGIS1_GDAL_CHECKOUT +ENV PGIS1_GDAL_CHECKOUT ${PGIS1_GDAL_CHECKOUT} +ARG PGIS1_GDAL_CHECKOUT_SHA1 + + + +# Install Arrow C++ +# also check the "Build final image" section too, for the final installation +RUN set -eux \ + # add backports \ + && apt-get update \ + && apt install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get update \ + # Automatically determine the latest PGIS1 Arrow version and SOVERSION + && apt-cache showpkg libarrow-dev \ + && PGIS1_ARROW_VERSION=$(apt-cache showpkg libarrow-dev | grep -m1 'Versions:' -A1 | tail -n1 | grep -oP '^\S+') \ + && apt-cache depends libarrow-dev=${PGIS1_ARROW_VERSION} | tee /_pgis1_libarrow-dev-dependencies.txt \ + && PGIS1_ARROW_SOVERSION=$(grep 'Depends: libarrow' /_pgis1_libarrow-dev-dependencies.txt | grep -oP 'libarrow\K[0-9]+') \ + && echo "Detected PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" \ + && echo "Detected PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + # Backup the version variables - reusing in a later stage + && echo "PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" > /_pgis1_arrow_environment.env \ + && echo "PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" >> /_pgis1_arrow_environment.env \ + # Install Arrow C++ + && apt-get install -y --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + libarrow-dev=${PGIS1_ARROW_VERSION} \ + libparquet-dev=${PGIS1_ARROW_VERSION} \ + libarrow-acero-dev=${PGIS1_ARROW_VERSION} \ + libarrow-dataset-dev=${PGIS1_ARROW_VERSION} \ + \ + libblosc-dev \ + libcfitsio-dev \ + libfreexl-dev \ + libfyba-dev \ + libhdf5-dev \ + libheif-dev \ + libkml-dev \ + libnetcdf-dev \ + libopenjp2-7-dev \ + libpng-dev \ + libqhull-dev \ + libspatialite-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +## GDAL_build-end + +RUN set -eux \ + && ldconfig \ + && cd /usr/src \ + && mkdir gdal \ + && cd gdal \ + && git init \ + && git remote add origin ${PGIS1_GDAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GDAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GDAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GDAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GDAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GDAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GDAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GDAL_CHECKOUT_SHA1}" ]; then \ + echo "GDAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_gdal_last_commit.txt \ + \ + # gdal project directory structure - has been changed ! + && if [ -d "gdal" ] ; then \ + echo "Directory 'gdal' dir exists -> older version!" ; \ + cd gdal ; \ + else \ + echo "Directory 'gdal' does not exists! Newer version! " ; \ + fi \ + \ + && if [ -f "./autogen.sh" ]; then \ + # Building with autoconf ( old/deprecated ) + set -eux \ + && ./autogen.sh \ + && ./configure --disable-static \ + ; \ + else \ + # Building with cmake + set -eux \ + && mkdir build \ + && cd build \ + # config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules + && cmake .. \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DBUILD_TESTING=OFF \ + -DBUILD_DOCS=OFF \ + \ + -DGDAL_HIDE_INTERNAL_SYMBOLS=ON \ + -DRENAME_INTERNAL_TIFF_SYMBOLS=ON \ + -DGDAL_USE_CURL=ON \ + -DGDAL_USE_DEFLATE=ON \ + -DGDAL_USE_EXPAT=ON \ + -DGDAL_USE_GEOS=ON \ + -DGDAL_USE_JSONC=ON \ + -DGDAL_USE_LIBLZMA=ON \ + -DGDAL_USE_LIBXML2=ON \ + -DGDAL_USE_LZ4=ON \ + -DGDAL_USE_POSTGRESQL=ON \ + -DGDAL_USE_SQLITE3=ON \ + -DGDAL_USE_TIFF=ON \ + -DGDAL_USE_WEBP=ON \ + -DGDAL_USE_ZLIB=ON \ + -DGDAL_USE_ZSTD=ON \ + \ + -DGDAL_USE_ARROW=ON \ + -DGDAL_USE_ARROWDATASET=ON \ + -DGDAL_USE_BLOSC=ON \ + -DGDAL_USE_CFITSIO=ON \ + -DGDAL_USE_FREEXL=ON \ + -DGDAL_USE_FYBA=ON \ + -DGDAL_USE_HDF5=ON \ + -DGDAL_USE_HEIF=ON \ + -DGDAL_USE_LERC_INTERNAL=ON \ + -DGDAL_USE_LIBKML=ON \ + -DGDAL_USE_NETCDF=ON \ + -DGDAL_USE_OPENJPEG=ON \ + -DGDAL_USE_PARQUET=ON \ + -DGDAL_USE_PNG=ON \ + -DGDAL_USE_QHULL=ON \ + -DGDAL_USE_SPATIALITE=ON \ + ; \ + fi \ + \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/gdal + +# Minimal command line test. +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + && pcre-config --version + +# ------------------------------------------- +# final stage +# ------------------------------------------- +FROM ${PGIS1_BASE_IMAGE} + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS - 17-master spatial database extension with PostgreSQL 17 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ARG PGIS1_CMAKE_BUILD_TYPE +ARG PGIS1_BASE_IMAGE +ARG PGIS1_BOOST_VERSION + +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + PGIS1_BASE_IMAGE=${PGIS1_BASE_IMAGE} \ + PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +RUN set -eux \ + && apt-get update \ + && apt-get install -y -V --no-install-recommends \ + \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libpcre3 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=stage0-builder /_pgis*.* / +COPY --from=stage0-builder /usr/local /usr/local + +# Install Arrow + Parquet + other GDAL extra dependencies + +RUN set -eux \ + # Install Arrow + Parquet + && apt-get update \ + && apt-get install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get update \ + # Load the PGIS1_ARROW version variables + && . /_pgis1_arrow_environment.env \ + # Use the PGIS1_ARROW_SOVERSION as needed + && echo "Using PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + && apt-get install -y -V --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + \ + # Install GDAL extra dependencies + libblosc1 \ + libcrypto++8 \ + libfreexl1 \ + libfyba0 \ + libhdf5-103-1 \ + libheif1 \ + libkmlbase1 \ + libkmldom1 \ + libkmlengine1 \ + libnetcdf19 \ + libopenjp2-7 \ + libpng16-16 \ + libqhull-r8.0 \ + librasterlite2-1 \ + libspatialite7 \ + netcdf-bin \ + libcfitsio10 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + + +ARG PGIS1_GDAL_CHECKOUT +ARG PGIS1_GDAL_REPOSITORY +ARG PGIS1_GEOS_CHECKOUT +ARG PGIS1_GEOS_REPOSITORY +ARG PGIS1_PROJ_CHECKOUT +ARG PGIS1_PROJ_REPOSITORY +ARG PGIS1_SFCGAL_CHECKOUT +ARG PGIS1_SFCGAL_REPOSITORY +ARG PGIS1_CGAL_REPOSITORY +ARG PGIS1_CGAL_CHECKOUT + +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +ENV PGIS1_GDAL_CHECKOUT=${PGIS1_GDAL_CHECKOUT} \ + PGIS1_GDAL_REPOSITORY=${PGIS1_GDAL_REPOSITORY} \ + PGIS1_GEOS_CHECKOUT=${PGIS1_GEOS_CHECKOUT} \ + PGIS1_GEOS_REPOSITORY=${PGIS1_GEOS_REPOSITORY} \ + PGIS1_PROJ_CHECKOUT=${PGIS1_PROJ_CHECKOUT} \ + PGIS1_PROJ_REPOSITORY=${PGIS1_PROJ_REPOSITORY} \ + PGIS1_CGAL_CHECKOUT=${PGIS1_CGAL_CHECKOUT} \ + PGIS1_CGAL_REPOSITORY=${PGIS1_CGAL_REPOSITORY} \ + PGIS1_SFCGAL_CHECKOUT=${PGIS1_SFCGAL_CHECKOUT} \ + PGIS1_SFCGAL_REPOSITORY=${PGIS1_SFCGAL_REPOSITORY} \ + PGIS1_POSTGIS_CHECKOUT=${PGIS1_POSTGIS_CHECKOUT} \ + PGIS1_POSTGIS_REPOSITORY=${PGIS1_POSTGIS_REPOSITORY} + +# Minimal command line test ( fail fast ) +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + \ + # Testing ogr2ogr PostgreSQL driver. + && ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \ + || echo "ogr2ogr missing PostgreSQL driver" && exit 1 + +# Specify GDAL_CONFIG and LD_LIBRARY_PATH for PostGIS build; +# The arm64 build is very senitive. +ENV GDAL_CONFIG /usr/local/bin/gdal-config +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +# temporary workaround for : nitdb: invalid locale settings; check LANG and LC_* environment variables +# https://github.com/docker-library/postgres/issues/1112#issuecomment-1746076388 +RUN set -eux \ + && echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcunit1-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && cd \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_POSTGIS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_POSTGIS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_POSTGIS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping POSTGIS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ]; then \ + echo "POSTGIS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_last_commit.txt \ + && ldconfig \ + && ./autogen.sh \ +# configure options taken from: +# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ +# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316 + && if command -v projsync >/dev/null 2>&1; then \ + projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn ; \ + fi \ +# regress check + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && ldconfig \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# clean + && cd / \ + && rm -rf /usr/src/postgis \ + && apt-get purge -y --autoremove \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin + +# last final test +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + # check any missing dependencies + && ldd /usr/lib/postgresql/$PG_MAJOR/lib/*.so | grep 'not found' && exit 1 || true \ + \ + # Is the "ca-certificates" package installed? (for accessing remote raster files) + # https://github.com/postgis/docker-postgis/issues/307 + && dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \ + \ + # list last commits. + && find /_pgis*_commit.txt -type f -print -exec cat {} \; \ + # list postgresql, postgis version + && cat _pgis_full_version.txt diff --git a/17-master/bookworm/initdb-postgis.sh b/17-master/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/17-master/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/17-master/bookworm/tags b/17-master/bookworm/tags new file mode 100644 index 00000000..1358267c --- /dev/null +++ b/17-master/bookworm/tags @@ -0,0 +1 @@ +17-master-bookworm 17-master diff --git a/17-master/bookworm/update-postgis.sh b/17-master/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/17-master/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/17-recent/bookworm/Dockerfile b/17-recent/bookworm/Dockerfile new file mode 100644 index 00000000..7a225bea --- /dev/null +++ b/17-recent/bookworm/Dockerfile @@ -0,0 +1,730 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# source: "Dockerfile.master.template" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +# "Experimental"; solely for testing purposes. Anticipate frequent changes! +# This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05. + +ARG PGIS1_BASE_IMAGE=postgres:17-bookworm + +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_GEOS_REPOSITORY=https://github.com/libgeos/geos.git +ARG PGIS1_GDAL_REPOSITORY=https://github.com/OSGeo/gdal.git +ARG PGIS1_PROJ_REPOSITORY=https://github.com/OSGeo/PROJ.git +ARG PGIS1_SFCGAL_REPOSITORY=https://gitlab.com/sfcgal/SFCGAL.git +ARG PGIS1_CGAL_REPOSITORY=https://github.com/CGAL/cgal.git + +# Should valid git checkout ( SHA1, tags, branches ) +ARG PGIS1_POSTGIS_CHECKOUT=tags/3.5.0 +ARG PGIS1_GEOS_CHECKOUT=tags/3.13.0 +ARG PGIS1_GDAL_CHECKOUT=tags/v3.10.0 +ARG PGIS1_PROJ_CHECKOUT=tags/9.5.0 +ARG PGIS1_SFCGAL_CHECKOUT=tags/v2.0.0 +ARG PGIS1_CGAL_CHECKOUT=tags/v6.0.1 + +# Skip SHA1 check if PGIS1_*_CHECKOUT_SHA1 is empty or 'nocheck' +# Otherwise, verify that the commit hash matches +ARG PGIS1_POSTGIS_CHECKOUT_SHA1=d2c3ca48e648571deda98d8e4d9bb4e2c82fde16 +ARG PGIS1_GEOS_CHECKOUT_SHA1=d7957246c588aa9c690efe67924fd70e741a06ab +ARG PGIS1_GDAL_CHECKOUT_SHA1=35a44cc570cdf4dbd55611e4bd61da76e56bc221 +ARG PGIS1_PROJ_CHECKOUT_SHA1=0a407325fbb5bf42407a7dc5d4f948be9707e302 +ARG PGIS1_SFCGAL_CHECKOUT_SHA1=5d4eb5e896c41e592534ba1e79ccc721c66d66e3 +ARG PGIS1_CGAL_CHECKOUT_SHA1=50cfbde3b84dbeae8338268db2d78fe4fcb522de + +ARG PGIS1_BOOST_VERSION=1.74.0 +ARG PGIS1_CMAKE_BUILD_TYPE=Release + +ARG PGIS1_GDAL_BUILD=with_extra +# Full GDAL build ; with arrow, parquet and extra dependencies + +FROM ${PGIS1_BASE_IMAGE} as builder + +WORKDIR / + +ARG PGIS1_BOOST_VERSION +ENV PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +# apt-get install +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + # build dependency + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libpq-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + make \ + pkg-config \ + protobuf-c-compiler \ + xsltproc \ + # gdal+ + liblz4-dev \ + liblzma-dev \ + libwebp-dev \ + libzstd-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ARG PGIS1_CMAKE_BUILD_TYPE +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} + +FROM builder as cgal-sfcgal-builder + +# cgal & sfcgal +ARG PGIS1_SFCGAL_REPOSITORY +ENV PGIS1_SFCGAL_REPOSITORY ${PGIS1_SFCGAL_REPOSITORY} +ARG PGIS1_SFCGAL_CHECKOUT +ENV PGIS1_SFCGAL_CHECKOUT ${PGIS1_SFCGAL_CHECKOUT} +ARG PGIS1_SFCGAL_CHECKOUT_SHA1 + +ARG PGIS1_CGAL_REPOSITORY +ENV PGIS1_CGAL_REPOSITORY ${PGIS1_CGAL_REPOSITORY} +ARG PGIS1_CGAL_CHECKOUT +ENV PGIS1_CGAL_CHECKOUT ${PGIS1_CGAL_CHECKOUT} +ARG PGIS1_CGAL_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir cgal \ + && cd cgal \ + && git init \ + && git remote add origin ${PGIS1_CGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_CGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_CGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_CGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_CGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_CGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping CGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_CGAL_CHECKOUT_SHA1}" ]; then \ + echo "CGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_cgal_last_commit.txt \ + && cd /usr/src \ + && mkdir SFCGAL \ + && cd SFCGAL \ + && git init \ + && git remote add origin ${PGIS1_SFCGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_SFCGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_SFCGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_SFCGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_SFCGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping SFCGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ]; then \ + echo "SFCGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_sfcgal_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. \ + -DCGAL_DIR=/usr/src/cgal \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DSFCGAL_BUILD_BENCH=OFF \ + -DSFCGAL_BUILD_EXAMPLES=OFF \ + -DSFCGAL_BUILD_TESTS=OFF \ + -DSFCGAL_WITH_OSG=OFF \ + && make -j$(nproc) \ + && make install \ + # clean + && rm -fr /usr/src/SFCGAL \ + && rm -fr /usr/src/cgal + + +FROM builder as proj-builder + +# proj +ARG PGIS1_PROJ_REPOSITORY +ENV PGIS1_PROJ_REPOSITORY ${PGIS1_PROJ_REPOSITORY} +ARG PGIS1_PROJ_CHECKOUT +ENV PGIS1_PROJ_CHECKOUT ${PGIS1_PROJ_CHECKOUT} +ARG PGIS1_PROJ_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir PROJ \ + && cd PROJ \ + && git init \ + && git remote add origin ${PGIS1_PROJ_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PROJ_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_PROJ_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_PROJ_CHECKOUT_SHA1 + && if [ -z "${PGIS1_PROJ_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_PROJ_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping PROJ SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_PROJ_CHECKOUT_SHA1}" ]; then \ + echo "PROJ SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_proj_last_commit.txt \ + # check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027 + && if [ -f "autogen.sh" ] ; then \ + set -eux \ + && echo "autotools version: 'autogen.sh' exists! Older version!" \ + && ./autogen.sh \ + && ./configure --disable-static \ + && make -j$(nproc) \ + && make install \ + ; \ + else \ + set -eux \ + && echo "cmake version: 'autogen.sh' does not exists! Newer version!" \ + && mkdir build \ + && cd build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + ; \ + fi \ + \ + && rm -fr /usr/src/PROJ + + +FROM builder as geos-builder + +# geos +ARG PGIS1_GEOS_REPOSITORY +ENV PGIS1_GEOS_REPOSITORY ${PGIS1_GEOS_REPOSITORY} +ARG PGIS1_GEOS_CHECKOUT +ENV PGIS1_GEOS_CHECKOUT ${PGIS1_GEOS_CHECKOUT} +ARG PGIS1_GEOS_CHECKOUT_SHA1 + +RUN set -eux \ + && cd /usr/src \ + && mkdir geos \ + && cd geos \ + && git init \ + && git remote add origin ${PGIS1_GEOS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GEOS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GEOS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GEOS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GEOS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GEOS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GEOS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GEOS_CHECKOUT_SHA1}" ]; then \ + echo "GEOS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_geos_last_commit.txt \ + && mkdir cmake-build \ + && cd cmake-build \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/geos + + +FROM builder as stage0-builder + +COPY --from=cgal-sfcgal-builder /_pgis*.* / +COPY --from=cgal-sfcgal-builder /usr/local /usr/local + +COPY --from=proj-builder /_pgis*.* / +COPY --from=proj-builder /usr/local /usr/local + +COPY --from=geos-builder /_pgis*.* / +COPY --from=geos-builder /usr/local /usr/local +# gdal +ARG PGIS1_GDAL_REPOSITORY +ENV PGIS1_GDAL_REPOSITORY ${PGIS1_GDAL_REPOSITORY} +ARG PGIS1_GDAL_CHECKOUT +ENV PGIS1_GDAL_CHECKOUT ${PGIS1_GDAL_CHECKOUT} +ARG PGIS1_GDAL_CHECKOUT_SHA1 + + + +# Install Arrow C++ +# also check the "Build final image" section too, for the final installation +RUN set -eux \ + # add backports \ + && apt-get update \ + && apt install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get update \ + # Automatically determine the latest PGIS1 Arrow version and SOVERSION + && apt-cache showpkg libarrow-dev \ + && PGIS1_ARROW_VERSION=$(apt-cache showpkg libarrow-dev | grep -m1 'Versions:' -A1 | tail -n1 | grep -oP '^\S+') \ + && apt-cache depends libarrow-dev=${PGIS1_ARROW_VERSION} | tee /_pgis1_libarrow-dev-dependencies.txt \ + && PGIS1_ARROW_SOVERSION=$(grep 'Depends: libarrow' /_pgis1_libarrow-dev-dependencies.txt | grep -oP 'libarrow\K[0-9]+') \ + && echo "Detected PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" \ + && echo "Detected PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + # Backup the version variables - reusing in a later stage + && echo "PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" > /_pgis1_arrow_environment.env \ + && echo "PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" >> /_pgis1_arrow_environment.env \ + # Install Arrow C++ + && apt-get install -y --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + libarrow-dev=${PGIS1_ARROW_VERSION} \ + libparquet-dev=${PGIS1_ARROW_VERSION} \ + libarrow-acero-dev=${PGIS1_ARROW_VERSION} \ + libarrow-dataset-dev=${PGIS1_ARROW_VERSION} \ + \ + libblosc-dev \ + libcfitsio-dev \ + libfreexl-dev \ + libfyba-dev \ + libhdf5-dev \ + libheif-dev \ + libkml-dev \ + libnetcdf-dev \ + libopenjp2-7-dev \ + libpng-dev \ + libqhull-dev \ + libspatialite-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +## GDAL_build-end + +RUN set -eux \ + && ldconfig \ + && cd /usr/src \ + && mkdir gdal \ + && cd gdal \ + && git init \ + && git remote add origin ${PGIS1_GDAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GDAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GDAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GDAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GDAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GDAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GDAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GDAL_CHECKOUT_SHA1}" ]; then \ + echo "GDAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_gdal_last_commit.txt \ + \ + # gdal project directory structure - has been changed ! + && if [ -d "gdal" ] ; then \ + echo "Directory 'gdal' dir exists -> older version!" ; \ + cd gdal ; \ + else \ + echo "Directory 'gdal' does not exists! Newer version! " ; \ + fi \ + \ + && if [ -f "./autogen.sh" ]; then \ + # Building with autoconf ( old/deprecated ) + set -eux \ + && ./autogen.sh \ + && ./configure --disable-static \ + ; \ + else \ + # Building with cmake + set -eux \ + && mkdir build \ + && cd build \ + # config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules + && cmake .. \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DBUILD_TESTING=OFF \ + -DBUILD_DOCS=OFF \ + \ + -DGDAL_HIDE_INTERNAL_SYMBOLS=ON \ + -DRENAME_INTERNAL_TIFF_SYMBOLS=ON \ + -DGDAL_USE_CURL=ON \ + -DGDAL_USE_DEFLATE=ON \ + -DGDAL_USE_EXPAT=ON \ + -DGDAL_USE_GEOS=ON \ + -DGDAL_USE_JSONC=ON \ + -DGDAL_USE_LIBLZMA=ON \ + -DGDAL_USE_LIBXML2=ON \ + -DGDAL_USE_LZ4=ON \ + -DGDAL_USE_POSTGRESQL=ON \ + -DGDAL_USE_SQLITE3=ON \ + -DGDAL_USE_TIFF=ON \ + -DGDAL_USE_WEBP=ON \ + -DGDAL_USE_ZLIB=ON \ + -DGDAL_USE_ZSTD=ON \ + \ + -DGDAL_USE_ARROW=ON \ + -DGDAL_USE_ARROWDATASET=ON \ + -DGDAL_USE_BLOSC=ON \ + -DGDAL_USE_CFITSIO=ON \ + -DGDAL_USE_FREEXL=ON \ + -DGDAL_USE_FYBA=ON \ + -DGDAL_USE_HDF5=ON \ + -DGDAL_USE_HEIF=ON \ + -DGDAL_USE_LERC_INTERNAL=ON \ + -DGDAL_USE_LIBKML=ON \ + -DGDAL_USE_NETCDF=ON \ + -DGDAL_USE_OPENJPEG=ON \ + -DGDAL_USE_PARQUET=ON \ + -DGDAL_USE_PNG=ON \ + -DGDAL_USE_QHULL=ON \ + -DGDAL_USE_SPATIALITE=ON \ + ; \ + fi \ + \ + && make -j$(nproc) \ + && make install \ + && cd / \ + && rm -fr /usr/src/gdal + +# Minimal command line test. +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + && pcre-config --version + +# ------------------------------------------- +# final stage +# ------------------------------------------- +FROM ${PGIS1_BASE_IMAGE} + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS - 17-recent spatial database extension with PostgreSQL 17 bookworm" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ARG PGIS1_CMAKE_BUILD_TYPE +ARG PGIS1_BASE_IMAGE +ARG PGIS1_BOOST_VERSION + +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + PGIS1_BASE_IMAGE=${PGIS1_BASE_IMAGE} \ + PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + +RUN set -eux \ + && apt-get update \ + && apt-get install -y -V --no-install-recommends \ + \ + curl \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ + libcurl3-gnutls \ + libexpat1 \ + libgmp10 \ + libgmpxx4ldbl \ + libjson-c5 \ + libmpfr6 \ + libpcre3 \ + libprotobuf-c1 \ + libtiff6 \ + libxml2 \ + sqlite3 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=stage0-builder /_pgis*.* / +COPY --from=stage0-builder /usr/local /usr/local + +# Install Arrow + Parquet + other GDAL extra dependencies + +RUN set -eux \ + # Install Arrow + Parquet + && apt-get update \ + && apt-get install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-bookworm.deb \ + && apt-get update \ + # Load the PGIS1_ARROW version variables + && . /_pgis1_arrow_environment.env \ + # Use the PGIS1_ARROW_SOVERSION as needed + && echo "Using PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + && apt-get install -y -V --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + \ + # Install GDAL extra dependencies + libblosc1 \ + libcrypto++8 \ + libfreexl1 \ + libfyba0 \ + libhdf5-103-1 \ + libheif1 \ + libkmlbase1 \ + libkmldom1 \ + libkmlengine1 \ + libnetcdf19 \ + libopenjp2-7 \ + libpng16-16 \ + libqhull-r8.0 \ + librasterlite2-1 \ + libspatialite7 \ + netcdf-bin \ + libcfitsio10 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + + +ARG PGIS1_GDAL_CHECKOUT +ARG PGIS1_GDAL_REPOSITORY +ARG PGIS1_GEOS_CHECKOUT +ARG PGIS1_GEOS_REPOSITORY +ARG PGIS1_PROJ_CHECKOUT +ARG PGIS1_PROJ_REPOSITORY +ARG PGIS1_SFCGAL_CHECKOUT +ARG PGIS1_SFCGAL_REPOSITORY +ARG PGIS1_CGAL_REPOSITORY +ARG PGIS1_CGAL_CHECKOUT + +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +ENV PGIS1_GDAL_CHECKOUT=${PGIS1_GDAL_CHECKOUT} \ + PGIS1_GDAL_REPOSITORY=${PGIS1_GDAL_REPOSITORY} \ + PGIS1_GEOS_CHECKOUT=${PGIS1_GEOS_CHECKOUT} \ + PGIS1_GEOS_REPOSITORY=${PGIS1_GEOS_REPOSITORY} \ + PGIS1_PROJ_CHECKOUT=${PGIS1_PROJ_CHECKOUT} \ + PGIS1_PROJ_REPOSITORY=${PGIS1_PROJ_REPOSITORY} \ + PGIS1_CGAL_CHECKOUT=${PGIS1_CGAL_CHECKOUT} \ + PGIS1_CGAL_REPOSITORY=${PGIS1_CGAL_REPOSITORY} \ + PGIS1_SFCGAL_CHECKOUT=${PGIS1_SFCGAL_CHECKOUT} \ + PGIS1_SFCGAL_REPOSITORY=${PGIS1_SFCGAL_REPOSITORY} \ + PGIS1_POSTGIS_CHECKOUT=${PGIS1_POSTGIS_CHECKOUT} \ + PGIS1_POSTGIS_REPOSITORY=${PGIS1_POSTGIS_REPOSITORY} + +# Minimal command line test ( fail fast ) +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + \ + # Testing ogr2ogr PostgreSQL driver. + && ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \ + || echo "ogr2ogr missing PostgreSQL driver" && exit 1 + +# Specify GDAL_CONFIG and LD_LIBRARY_PATH for PostGIS build; +# The arm64 build is very senitive. +ENV GDAL_CONFIG /usr/local/bin/gdal-config +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +# temporary workaround for : nitdb: invalid locale settings; check LANG and LC_* environment variables +# https://github.com/docker-library/postgres/issues/1112#issuecomment-1746076388 +RUN set -eux \ + && echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcunit1-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && cd \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_POSTGIS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_POSTGIS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_POSTGIS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping POSTGIS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ]; then \ + echo "POSTGIS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ + && git log -1 > /_pgis_last_commit.txt \ + && ldconfig \ + && ./autogen.sh \ +# configure options taken from: +# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie + && ./configure \ + --enable-lto \ + && make -j$(nproc) \ + && make install \ +# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316 + && if command -v projsync >/dev/null 2>&1; then \ + projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn ; \ + fi \ +# regress check + && mkdir /tempdb \ + && chown -R postgres:postgres /tempdb \ + && su postgres -c 'pg_ctl -D /tempdb init' \ + && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ + && ldconfig \ + && cd regress \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \ + && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ + && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ + && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ + \ + && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ + && rm -rf /tempdb \ + && rm -rf /tmp/logfile \ + && rm -rf /tmp/pgis_reg \ +# clean + && cd / \ + && rm -rf /usr/src/postgis \ + && apt-get purge -y --autoremove \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + cmake \ + docbook-xml \ + docbook5-xml \ + g++ \ + git \ + libboost-all-dev \ + libcurl4-gnutls-dev \ + libgmp-dev \ + libjson-c-dev \ + libmpfr-dev \ + libpcre3-dev \ + libprotobuf-c-dev \ + libsqlite3-dev \ + libtiff-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + make \ + pkg-config \ + postgresql-server-dev-$PG_MAJOR \ + protobuf-c-compiler \ + xsltproc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin + +# last final test +RUN set -eux \ + && ldconfig \ + && cs2cs \ + && ldd $(which gdalinfo) \ + && gdalinfo --version \ + && gdal-config --formats \ + && geos-config --version \ + && ogr2ogr --version \ + && proj \ + && sfcgal-config --version \ + # check any missing dependencies + && ldd /usr/lib/postgresql/$PG_MAJOR/lib/*.so | grep 'not found' && exit 1 || true \ + \ + # Is the "ca-certificates" package installed? (for accessing remote raster files) + # https://github.com/postgis/docker-postgis/issues/307 + && dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \ + \ + # list last commits. + && find /_pgis*_commit.txt -type f -print -exec cat {} \; \ + # list postgresql, postgis version + && cat _pgis_full_version.txt diff --git a/17-recent/bookworm/initdb-postgis.sh b/17-recent/bookworm/initdb-postgis.sh new file mode 100644 index 00000000..21f8c373 --- /dev/null +++ b/17-recent/bookworm/initdb-postgis.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_postgis' template db +"${psql[@]}" <<-'EOSQL' +CREATE DATABASE template_postgis IS_TEMPLATE true; +EOSQL + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB"; do + echo "Loading PostGIS extensions into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS postgis; + CREATE EXTENSION IF NOT EXISTS postgis_topology; + -- Reconnect to update pg_setting.resetval + -- See https://github.com/postgis/docker-postgis/issues/288 + \c + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; +EOSQL +done diff --git a/17-recent/bookworm/tags b/17-recent/bookworm/tags new file mode 100644 index 00000000..02f8ebfe --- /dev/null +++ b/17-recent/bookworm/tags @@ -0,0 +1 @@ +17-recent-bookworm 17-recent-postgis3.5.0-geos3.13.0-proj9.5.0-gdal3.10.0-cgal6.0.1-sfcgal2.0.0-bookworm 17-recent-postgis3.5-geos3.13-proj9.5-gdal3.10-cgal6.0-sfcgal2.0-bookworm 17-recent recent diff --git a/17-recent/bookworm/update-postgis.sh b/17-recent/bookworm/update-postgis.sh new file mode 100755 index 00000000..f98abd26 --- /dev/null +++ b/17-recent/bookworm/update-postgis.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" + +# Load PostGIS into both template_database and $POSTGRES_DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" + psql --dbname="$DB" -c " + -- Upgrade PostGIS (includes raster) + CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; + + -- Upgrade Topology + CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; + + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + " +done diff --git a/Dockerfile.alpine.template b/Dockerfile.alpine.template index 8ed94dd7..d24e58ec 100644 --- a/Dockerfile.alpine.template +++ b/Dockerfile.alpine.template @@ -1,34 +1,23 @@ -# -# %%TXT_AUTOGENERATED%% -# -ARG BASE_IMAGE=postgres:%%PG_MAJOR%%-alpine3.18 -FROM ${BASE_IMAGE} + +ARG PGIS1_BASE_IMAGE=postgres:{{ .[env.variant].PG_DOCKER }}-{{ env.variant }} +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_POSTGIS_CHECKOUT={{ .[env.variant].POSTGIS_CHECKOUT }} +ARG PGIS1_POSTGIS_CHECKOUT_SHA1={{ .[env.variant].POSTGIS_CHECKOUT_SHA1 }} + +FROM ${PGIS1_BASE_IMAGE} + +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS %%POSTGIS_VERSION%% spatial database extension with PostgreSQL %%PG_MAJOR%% Alpine" \ + org.opencontainers.image.description="PostGIS ${PGIS1_POSTGIS_CHECKOUT} spatial database extension with PostgreSQL {{ .[env.variant].PG_MAJOR }} {{ env.variant }}" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION %%POSTGIS_VERSION%% -ENV POSTGIS_SHA256 %%POSTGIS_SHA256%% - RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ && apk add --no-cache --virtual .build-deps \ \ + ca-certificates \ gdal-dev \ geos-dev \ proj-dev \ @@ -42,6 +31,7 @@ RUN set -eux \ \ autoconf \ automake \ + bison \ cunit-dev \ file \ g++ \ @@ -51,11 +41,26 @@ RUN set -eux \ json-c-dev \ libtool \ libxml2-dev \ + libxml2-utils \ make \ - pcre2-dev \ + # Note: PCRE2 is not supported in older versions of PostGIS. + # To ensure compatibility with PostGIS version 3.0, PCRE 1 is required. + # If PCRE2 support is needed, please submit an issue on the docker-postgis GitHub repository. + pcre-dev \ perl \ protobuf-c-dev \ \ + # postgis + && cd /usr/src \ + && mkdir postgis \ + && cd postgis \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgis_last_commit.txt \ # build PostGIS - with Link Time Optimization (LTO) enabled && cd /usr/src/postgis \ && gettextize \ @@ -78,7 +83,7 @@ RUN set -eux \ && su postgres -c 'pg_ctl -D /tempdb init' \ && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ && cd regress \ - && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ + && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ @@ -106,16 +111,22 @@ RUN set -eux \ \ json-c \ libstdc++ \ - pcre2 \ + pcre \ protobuf-c \ \ + # for postgis_restore.pl ; ref: https://github.com/postgis/docker-postgis/issues/373 + perl \ # ca-certificates: for accessing remote raster files # fix https://github.com/postgis/docker-postgis/issues/307 ca-certificates \ # clean && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ + && rm -rf \ + /usr/src/postgis \ + /usr/local/share/doc \ + /usr/local/share/man \ + && apk del .build-deps \ + #&& apk del .fetch-deps \ # At the end of the build, we print the collected information # from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. && cat /_pgis_full_version.txt diff --git a/Dockerfile.bundle0.template b/Dockerfile.bundle0.template new file mode 100644 index 00000000..e15f5b80 --- /dev/null +++ b/Dockerfile.bundle0.template @@ -0,0 +1,452 @@ + + +# Experimental Geo Bundle package. +# This is a work in progress and not yet ready for production. +# Some packages will be removed from this bundle and others will be added. +# The goal is to have a bundle that includes all the most popular extensions with PostGIS + +# set the base image , make build-* is overwriting with the actual value ! + +ARG REGISTRY={{ env.REGISTRY }} +ARG REPO_NAME={{ env.REPO_NAME }} +ARG IMAGE_NAME={{ env.IMAGE_NAME }} + +ARG PGIS1_BASE_IMAGE=${REGISTRY}/${REPO_NAME}/${IMAGE_NAME}:{{ .[env.variant].PG_DOCKER }}-{{ .[env.variant].postgis }}-{{ env.variant }} + +ARG PGIS1_MOBILITYDB_REPOSITORY=https://github.com/MobilityDB/MobilityDB.git +ARG PGIS1_MOBILITYDB_CHECKOUT={{ .[env.variant].MOBILITYDB_CHECKOUT }} +ARG PGIS1_MOBILITYDB_CHECKOUT_SHA1={{ .[env.variant].MOBILITYDB_CHECKOUT_SHA1 }} + +ARG PGIS1_PGSQL_HTTP_REPOSITORY=https://github.com/pramsey/pgsql-http.git +ARG PGIS1_PGSQL_HTTP_CHECKOUT={{ .[env.variant].PGSQL_HTTP_CHECKOUT }} +ARG PGIS1_PGSQL_HTTP_CHECKOUT_SHA1={{ .[env.variant].PGSQL_HTTP_CHECKOUT_SHA1 }} + +ARG PGIS1_PGSQL_GZIP_REPOSITORY=https://github.com/pramsey/pgsql-gzip.git +ARG PGIS1_PGSQL_GZIP_CHECKOUT={{ .[env.variant].PGSQL_GZIP_CHECKOUT }} +ARG PGIS1_PGSQL_GZIP_CHECKOUT_SHA1={{ .[env.variant].PGSQL_GZIP_CHECKOUT_SHA1 }} + +ARG PGIS1_TIMESCALEDB_APACHE_ONLY=false +ARG PGIS1_TIMESCALEDB_REPOSITORY=https://github.com/timescale/timescaledb.git +ARG PGIS1_TIMESCALEDB_CHECKOUT={{ .[env.variant].TIMESCALEDB_CHECKOUT }} +ARG PGIS1_TIMESCALEDB_CHECKOUT_SHA1={{ .[env.variant].TIMESCALEDB_CHECKOUT_SHA1 }} + +ARG PGIS1_PG_HINT_PLAN_REPOSITORY=https://github.com/ossc-db/pg_hint_plan.git +ARG PGIS1_PG_HINT_PLAN_CHECKOUT={{ .[env.variant].PG_HINT_PLAN_CHECKOUT }} +ARG PGIS1_PG_HINT_PLAN_CHECKOUT_SHA1={{ .[env.variant].PG_HINT_PLAN_CHECKOUT_SHA1 }} + +ARG PGIS1_DUCKDB_CHECKOUT={{ .[env.variant].DUCKDB_CHECKOUT }} + +FROM ${PGIS1_BASE_IMAGE} AS builder + +ARG PGIS1_DUCKDB_CHECKOUT + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + autotools-dev \ + bison \ + build-essential \ + cmake \ + curl \ + flex \ + g++ \ + git \ + make \ + pgxnclient \ + postgresql-server-dev-$PG_MAJOR \ + unzip \ + wget \ + # MobilityDB + libgeos++-dev \ + libgsl-dev \ + libjson-c-dev \ + libproj-dev \ + # TimescaleDB + libkrb5-dev \ + # pgsql-http + libcurl4-gnutls-dev \ + # hydra (columnar) + liblz4-dev \ + # pgsql-gzip + zlib1g-dev \ + # sqlite_fdw + sqlite3 \ + # plv8 + ninja-build \ + pkg-config \ + # bytemagic + libmagic-dev \ + # pgsoudium \ + libsodium-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +FROM builder as builder-http-gzip + +ARG PGIS1_PGSQL_HTTP_REPOSITORY +ARG PGIS1_PGSQL_HTTP_CHECKOUT +ARG PGIS1_PGSQL_HTTP_CHECKOUT_SHA1 + +ARG PGIS1_PGSQL_GZIP_REPOSITORY +ARG PGIS1_PGSQL_GZIP_CHECKOUT +ARG PGIS1_PGSQL_GZIP_CHECKOUT_SHA1 + +RUN set -eux \ + && mkdir -p /pgsql-gzip \ + && cd pgsql-gzip \ + && git init \ + && git remote add origin ${PGIS1_PGSQL_GZIP_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PGSQL_GZIP_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_PGSQL_GZIP_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgsql_gzip_last_commit.txt \ + && make -j$(nproc) \ + && make install + +RUN set -eux \ + && mkdir -p /pgsql-http \ + && cd pgsql-http \ + && git init \ + && git remote add origin ${PGIS1_PGSQL_HTTP_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PGSQL_HTTP_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_PGSQL_HTTP_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_pgsql_http_last_commit.txt \ + && make -j$(nproc) \ + && make install + + +FROM builder as builder-timescaledb + +ARG PGIS1_TIMESCALEDB_APACHE_ONLY +ARG PGIS1_TIMESCALEDB_REPOSITORY +ARG PGIS1_TIMESCALEDB_CHECKOUT +ARG PGIS1_TIMESCALEDB_CHECKOUT_SHA1 + +# Install TimescaleDB; no Arm64 apt support, so build from source +RUN set -eux \ + && mkdir -p /timescaledb \ + && cd timescaledb \ + && git init \ + && git remote add origin ${PGIS1_TIMESCALEDB_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_TIMESCALEDB_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_TIMESCALEDB_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_timescaledb_last_commit.txt \ + && ./bootstrap \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ + -DCMAKE_POLICY_DEFAULT_CMP0069=NEW \ + \ + -DAPACHE_ONLY=${PGIS1_TIMESCALEDB_APACHE_ONLY} \ + -DREGRESS_CHECKS=OFF \ + -DSEND_TELEMETRY_DEFAULT=NO \ + -DTAP_CHECKS=OFF \ + -DWARNINGS_AS_ERRORS=OFF \ + -DENABLE_DEBUG_UTILS=OFF \ + && cd build \ + && make -j$(nproc) \ + && make install + +FROM builder as builder-mobilitydb + +ARG PGIS1_MOBILITYDB_REPOSITORY +ARG PGIS1_MOBILITYDB_CHECKOUT +ARG PGIS1_MOBILITYDB_CHECKOUT_SHA1 + +# Install MobilityDB +RUN set -eux \ + && mkdir -p /MobilityDB \ + && cd MobilityDB \ + && git init \ + && git remote add origin ${PGIS1_MOBILITYDB_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_MOBILITYDB_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_MOBILITYDB_CHECKOUT_SHA1" ]; then exit 1; fi \ + && git log -1 > /_MobilityDB_last_commit.txt \ + && mkdir build \ + && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ + -DCMAKE_POLICY_DEFAULT_CMP0069=NEW \ + .. \ + && make -j$(nproc) \ + && make install + + +FROM builder as builder-pgxn + +RUN pgxn install --verbose byteamagic +RUN pgxn install --verbose ddlx +RUN pgxn install --verbose dsef +RUN pgxn install --verbose json_accessors +RUN pgxn install --verbose lostgis + +#RUN pgxn install --verbose parray_gin # not working on CircleCI arm .. yet +RUN pgxn install --verbose permuteseq +RUN pgxn install --verbose pg_curl # https://github.com/RekGRpth/pg_curl +RUN pgxn install --verbose pg_roaringbitmap +RUN pgxn install --verbose pg_rowalesce +RUN pgxn install --verbose pg_uuidv7 +RUN pgxn install --verbose pg_xenophile +RUN pgxn install --verbose pg_xxhash +RUN pgxn install --verbose pgsodium +RUN pgxn install --verbose pgsql_tweaks + +{{ if env.version | startswith("17") then ( -}} +# sqlite_fdw is not available for PG17 +{{ ) else ( -}} +RUN USE_PGXS=1 pgxn install sqlite_fdw +{{ ) end -}} + + +FROM builder as builder-other + +ARG PGIS1_PG_HINT_PLAN_REPOSITORY +ARG PGIS1_PG_HINT_PLAN_CHECKOUT +ARG PGIS1_PG_HINT_PLAN_CHECKOUT_SHA1 + + +{{ if env.version | startswith("17") then ( -}} +# hydradatabase/hydra is not available for PG17 +{{ ) else ( -}} +# Add hydradatabase +RUN set -eux \ + && git clone --depth 1 https://github.com/hydradatabase/hydra \ + && cd hydra/columnar \ + && git checkout main \ + && export COLUMNAR_O3=1 \ + && ./configure \ + && make -j$(nproc) \ + && make install +{{ ) end -}} + +# {{ if env.version | startswith("16") then ( -}} +# # pg_quack is not available for PG16 +# # - https://github.com/hydradatabase/pg_quack/issues/3 +# {{ ) else ( -}} +# # add pg_quack: PG 14 and PG 15 only (PG 16 is not yet supported) +# # TODO: add pg_quack version! +# RUN set -eux \ +# && git clone --depth 1 https://github.com/hydradatabase/pg_quack \ +# && cd pg_quack \ +# && make -j$(nproc) \ +# && make install +# {{ ) end -}} + +# install pg_hint_plan +RUN set -eux \ + && mkdir pg_hint_plan \ + && cd pg_hint_plan \ + && git init \ + && git remote add origin ${PGIS1_PG_HINT_PLAN_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PG_HINT_PLAN_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Verify that the commit hash matches the known good one + && if [ "$(git rev-parse HEAD)" != "$PGIS1_PG_HINT_PLAN_CHECKOUT_SHA1" ]; then exit 1; fi \ + && make -j$(nproc) \ + && make install + +RUN set -eux \ + && git clone --depth 1 https://github.com/NikolayS/postgres_dba.git \ + && cd postgres_dba \ + && rm -rf .git + +RUN set -eux \ + && git clone --depth 1 https://github.com/dr-jts/pg_svg.git \ + && cd pg_svg \ + && rm -rf .git + #install: psql < /pg_svg/pg-svg-lib.sql + +FROM ${REGISTRY}/${REPO_NAME}/${IMAGE_NAME}:{{ .[env.variant].PG_DOCKER }}-{{ .[env.variant].postgis }}-{{ env.variant }} + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS Bundle - {{ .[env.variant].PG_DOCKER }}-{{ .[env.variant].postgis }}-{{ env.variant }} " \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +# install all utf8 locales; +# helping: https://github.com/docker-library/docs/tree/master/postgres#locale-customization +RUN set -eux \ + && sed -i -e 's/# \(.*\.UTF-8\)/\1/' /etc/locale.gen \ + && locale-gen + +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + \ + bzip2 \ + curl \ + jq \ + unzip \ + wget \ + \ + gdal-bin \ + proj-bin \ + sqlite3 \ + \ + pipx \ + python-is-python3 \ + python3 \ + python3-geoalchemy2 \ + python3-pglast \ + python3-pip \ + python3-psycopg2 \ + python3-setuptools \ + python3-sqlalchemy \ + \ + postgis \ + postgresql \ + postgresql-client-common \ + postgresql-common \ + postgresql-contrib \ + postgresql-plpython3-$PG_MAJOR \ + postgresql-postgis \ + postgresql-postgis-scripts \ + \ + pg-activity \ + pgbackrest \ + pgbadger \ + pgtap \ + pgtop \ + pspg \ + vip-manager \ + \ +{{ if env.version | startswith("17") then ( -}} + #postgresql-$PG_MAJOR-age \ # not available for PG17 + #postgresql-$PG_MAJOR-decoderbufs \ # not available for PG17 +{{ ) else ( -}} + postgresql-$PG_MAJOR-age \ + postgresql-$PG_MAJOR-decoderbufs \ +{{ ) end -}} + \ + postgresql-$PG_MAJOR-asn1oid \ + postgresql-$PG_MAJOR-cron \ + postgresql-$PG_MAJOR-extra-window-functions \ + postgresql-$PG_MAJOR-first-last-agg \ + postgresql-$PG_MAJOR-h3 \ + postgresql-$PG_MAJOR-hll \ + postgresql-$PG_MAJOR-hypopg \ + postgresql-$PG_MAJOR-icu-ext \ + postgresql-$PG_MAJOR-jsquery \ + postgresql-$PG_MAJOR-numeral \ + postgresql-$PG_MAJOR-ogr-fdw \ + postgresql-$PG_MAJOR-partman \ + postgresql-$PG_MAJOR-periods \ + postgresql-$PG_MAJOR-pg-fact-loader \ + postgresql-$PG_MAJOR-pg-failover-slots \ + postgresql-$PG_MAJOR-pg-stat-kcache \ + postgresql-$PG_MAJOR-pg-wait-sampling \ + postgresql-$PG_MAJOR-pgaudit \ + postgresql-$PG_MAJOR-pgl-ddl-deploy \ + postgresql-$PG_MAJOR-pglogical \ + postgresql-$PG_MAJOR-pgmp \ + postgresql-$PG_MAJOR-pgpcre \ + postgresql-$PG_MAJOR-pgq3 \ + postgresql-$PG_MAJOR-pgrouting \ + postgresql-$PG_MAJOR-pgrouting-scripts \ + postgresql-$PG_MAJOR-pgsphere \ + postgresql-$PG_MAJOR-pgtap \ + postgresql-$PG_MAJOR-pgvector \ + postgresql-$PG_MAJOR-pldebugger \ + postgresql-$PG_MAJOR-plpgsql-check \ + postgresql-$PG_MAJOR-pointcloud \ + postgresql-$PG_MAJOR-prefix \ + postgresql-$PG_MAJOR-prioritize \ + postgresql-$PG_MAJOR-q3c \ + postgresql-$PG_MAJOR-repack \ + postgresql-$PG_MAJOR-rum \ + postgresql-$PG_MAJOR-show-plans \ + postgresql-$PG_MAJOR-squeeze \ + # add MobilityDb missing dependency from libgsl-dev + libgsl27 \ + # MeCab based tokenizer for pgdg-pgroonga + groonga-tokenizer-mecab \ + # bytemagic + libmagic1 libmagic-mgc \ + # pgsodium + libsodium23 \ + \ + && rm -Rf /root/.cache/pip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ARG PGIS1_DUCKDB_CHECKOUT +ENV PGIS1_DUCKDB_CHECKOUT=${PGIS1_DUCKDB_CHECKOUT} +RUN arch=$(uname -m) \ + && DUCKDB_VERSION=$(echo "$PGIS1_DUCKDB_CHECKOUT" | sed 's/tags\///') \ + && echo "DUCKDB_VERSION=${DUCKDB_VERSION}" \ + && echo "PGIS1_DUCKDB_CHECKOUT=${PGIS1_DUCKDB_CHECKOUT}" \ + && case "$arch" in \ + x86_64) \ + duck_binary="duckdb_cli-linux-amd64.zip" ;; \ + aarch64) \ + duck_binary="duckdb_cli-linux-aarch64.zip" ;; \ + *) \ + echo "Unsupported architecture: $arch"; exit 1 ;; \ + esac \ + && wget https://github.com/duckdb/duckdb/releases/download/${DUCKDB_VERSION}/$duck_binary \ + && unzip $duck_binary -d /usr/local/bin \ + && rm $duck_binary \ + && duckdb --version + +# install extensions +# https://duckdb.org/docs/extensions/overview.html +ENV DUCKDB_EXTENSIONS="arrow autocomplete excel fts httpfs icu inet json parquet postgres_scanner spatial sqlite_scanner substrait tpcds tpch visualizer" +RUN for e in ${DUCKDB_EXTENSIONS} ; do \ + echo "Installing $e ..."; \ + duckdb -c "INSTALL $e;"; \ + echo "LOAD $e;" >> $HOME/.duckdbrc; \ + done + +# Install from stages +COPY --from=builder-http-gzip /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-http-gzip /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-mobilitydb /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-mobilitydb /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-timescaledb /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-timescaledb /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-pgxn /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-pgxn /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-other /usr/share/postgresql/$PG_MAJOR/extension/ /usr/share/postgresql/$PG_MAJOR/extension/ +COPY --from=builder-other /usr/lib/postgresql/$PG_MAJOR/lib /usr/lib/postgresql/$PG_MAJOR/lib + +COPY --from=builder-other /postgres_dba /postgres_dba +COPY --from=builder-other /pg_svg /pg_svg + +# check any missing dependencies +RUN set -eux \ + && ldd /usr/lib/postgresql/$PG_MAJOR/lib/*.so | grep 'not found' && exit 1 || true + +# multiple LLVM existance is not optimal; so we give a warning. +# known problem: duplicated LLVM +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "WARNING: More than one llvm package or none at all found!"; \ + dpkg -l | grep llvm ; \ + fi + +# add MobilityDB requirements +RUN set -eux \ + && cp -v /usr/share/postgresql/postgresql.conf.sample /usr/share/postgresql/postgresql.conf.sample.orig; \ + # add MobilityDB and TimescaleDB requirements + echo "shared_preload_libraries = 'pg_hint_plan,postgis-3,timescaledb,pg_cron,pg_stat_statements'" >> /usr/share/postgresql/postgresql.conf.sample; \ + # MobilityDB recomendation + echo "max_locks_per_transaction = 128" >> /usr/share/postgresql/postgresql.conf.sample; \ + echo "timescaledb.telemetry_level=off" >> /usr/share/postgresql/postgresql.conf.sample + +# for postgres_dba Use ":dba" to see menu +RUN printf "%s %s %s %s\n" \\set dba \'\\\\i /postgres_dba/start.psql\' >> ~/.psqlrc + +COPY ./initdb-bundle0.sh /docker-entrypoint-initdb.d/11_bundle0.sh \ No newline at end of file diff --git a/Dockerfile.debian.template b/Dockerfile.debian.template new file mode 100644 index 00000000..4800d161 --- /dev/null +++ b/Dockerfile.debian.template @@ -0,0 +1,38 @@ +FROM postgres:{{ .[env.variant].PG_DOCKER }}-{{ env.variant }} + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS {{ .[env.variant].POSTGIS_VERSION }} spatial database extension with PostgreSQL {{ .[env.variant].PG_MAJOR }} {{ env.variant }}" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ENV POSTGIS_MAJOR {{ .[env.variant].POSTGIS_MAJOR }} +ENV POSTGIS_VERSION {{ .[env.variant].POSTGIS_VERSION }} + +RUN set -eux \ + && apt-get update \ + && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ + && apt-get install -y --no-install-recommends \ + # ca-certificates: for accessing remote raster files; + # fix: https://github.com/postgis/docker-postgis/issues/307 + ca-certificates \ + \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ +{{ if env.version | startswith("11") then ( -}} + # \ +{{ ) else ( -}} + postgis \ +{{ ) end -}} + && rm -rf /var/lib/apt/lists/* + +# multiple LLVM existance is not allowed. +RUN set -eux \ + && dpkg -l | grep llvm \ + && llvm_count=$(dpkg -l | grep llvm | wc -l) \ + && if [ "$llvm_count" -ne 1 ]; then \ + echo "More than one llvm package or none at all found. Stopping."; \ + exit 1; \ + fi + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh +COPY ./update-postgis.sh /usr/local/bin diff --git a/Dockerfile.master.template b/Dockerfile.master.template index 0b78eb15..7fd3220b 100644 --- a/Dockerfile.master.template +++ b/Dockerfile.master.template @@ -1,35 +1,64 @@ -# -# %%TXT_AUTOGENERATED%% -# - # "Experimental"; solely for testing purposes. Anticipate frequent changes! # This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05. -ARG DOCKER_CMAKE_BUILD_TYPE=Release -ARG CGAL_GIT_BRANCH=5.6.x-branch -FROM postgres:%%PG_MAJOR%%-%%DEBIAN_VERSION%% as builder +ARG PGIS1_BASE_IMAGE=postgres:{{ .[env.variant].PG_DOCKER }}-{{ env.variant }} -LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS - master spatial database extension with PostgreSQL %%PG_MAJOR%% %%DEBIAN_VERSION%%" \ - org.opencontainers.image.source="https://github.com/postgis/docker-postgis" +ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git +ARG PGIS1_GEOS_REPOSITORY=https://github.com/libgeos/geos.git +ARG PGIS1_GDAL_REPOSITORY=https://github.com/OSGeo/gdal.git +ARG PGIS1_PROJ_REPOSITORY=https://github.com/OSGeo/PROJ.git +ARG PGIS1_SFCGAL_REPOSITORY=https://gitlab.com/sfcgal/SFCGAL.git +ARG PGIS1_CGAL_REPOSITORY=https://github.com/CGAL/cgal.git + +# Should valid git checkout ( SHA1, tags, branches ) +ARG PGIS1_POSTGIS_CHECKOUT={{ .[env.variant].POSTGIS_CHECKOUT }} +ARG PGIS1_GEOS_CHECKOUT={{ .[env.variant].GEOS_CHECKOUT }} +ARG PGIS1_GDAL_CHECKOUT={{ .[env.variant].GDAL_CHECKOUT }} +ARG PGIS1_PROJ_CHECKOUT={{ .[env.variant].PROJ_CHECKOUT }} +ARG PGIS1_SFCGAL_CHECKOUT={{ .[env.variant].SFCGAL_CHECKOUT }} +ARG PGIS1_CGAL_CHECKOUT={{ .[env.variant].CGAL_CHECKOUT }} + +# Skip SHA1 check if PGIS1_*_CHECKOUT_SHA1 is empty or 'nocheck' +# Otherwise, verify that the commit hash matches +ARG PGIS1_POSTGIS_CHECKOUT_SHA1={{ .[env.variant].POSTGIS_CHECKOUT_SHA1 }} +ARG PGIS1_GEOS_CHECKOUT_SHA1={{ .[env.variant].GEOS_CHECKOUT_SHA1 }} +ARG PGIS1_GDAL_CHECKOUT_SHA1={{ .[env.variant].GDAL_CHECKOUT_SHA1 }} +ARG PGIS1_PROJ_CHECKOUT_SHA1={{ .[env.variant].PROJ_CHECKOUT_SHA1 }} +ARG PGIS1_SFCGAL_CHECKOUT_SHA1={{ .[env.variant].SFCGAL_CHECKOUT_SHA1 }} +ARG PGIS1_CGAL_CHECKOUT_SHA1={{ .[env.variant].CGAL_CHECKOUT_SHA1 }} + +ARG PGIS1_BOOST_VERSION={{ .[env.variant].BOOST_VERSION }} +ARG PGIS1_CMAKE_BUILD_TYPE=Release + +ARG PGIS1_GDAL_BUILD={{ .[env.variant].GDAL_BUILD }} +{{ if .[env.variant].GDAL_BUILD != "minimal" then ( -}} +# Full GDAL build ; with arrow, parquet and extra dependencies +{{ ) else ( -}} +# Minimal GDAL build ; no arrow, no parquet, no extra dependencies +{{ ) end -}} + +FROM ${PGIS1_BASE_IMAGE} as builder WORKDIR / +ARG PGIS1_BOOST_VERSION +ENV PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} + # apt-get install -RUN set -ex \ +RUN set -eux \ && apt-get update \ && apt-get install -y --no-install-recommends \ curl \ - libboost-atomic%%BOOST_VERSION%% \ - libboost-chrono%%BOOST_VERSION%% \ - libboost-date-time%%BOOST_VERSION%% \ - libboost-filesystem%%BOOST_VERSION%% \ - libboost-program-options%%BOOST_VERSION%% \ - libboost-serialization%%BOOST_VERSION%% \ - libboost-system%%BOOST_VERSION%% \ - libboost-test%%BOOST_VERSION%% \ - libboost-thread%%BOOST_VERSION%% \ - libboost-timer%%BOOST_VERSION%% \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ libcurl3-gnutls \ libexpat1 \ libgmp10 \ @@ -37,7 +66,11 @@ RUN set -ex \ libjson-c5 \ libmpfr6 \ libprotobuf-c1 \ +{{ if env.variant != "bullseye" then ( -}} + libtiff6 \ +{{ ) else ( -}} libtiff5 \ +{{ ) end -}} libxml2 \ sqlite3 \ # build dependency @@ -67,67 +100,114 @@ RUN set -ex \ protobuf-c-compiler \ xsltproc \ # gdal+ - libblosc-dev \ - libcfitsio-dev \ - libfreexl-dev \ - libfyba-dev \ - libhdf5-dev \ - libkml-dev \ liblz4-dev \ liblzma-dev \ - libopenjp2-7-dev \ - libqhull-dev \ libwebp-dev \ - libzstd-dev + libzstd-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* -ARG DOCKER_CMAKE_BUILD_TYPE -ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} +ARG PGIS1_CMAKE_BUILD_TYPE +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} + +FROM builder as cgal-sfcgal-builder # cgal & sfcgal -# By utilizing the latest commit of the CGAL 5.x.x-branch and implementing a header-only build for SFCGAL, -# one can benefit from the latest CGAL patches while avoiding compatibility issues. -ARG CGAL_GIT_BRANCH -ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL5X_GIT_HASH %%CGAL5X_GIT_HASH%% -ENV SFCGAL_GIT_HASH %%SFCGAL_GIT_HASH%% -RUN set -ex \ - && mkdir -p /usr/src \ +ARG PGIS1_SFCGAL_REPOSITORY +ENV PGIS1_SFCGAL_REPOSITORY ${PGIS1_SFCGAL_REPOSITORY} +ARG PGIS1_SFCGAL_CHECKOUT +ENV PGIS1_SFCGAL_CHECKOUT ${PGIS1_SFCGAL_CHECKOUT} +ARG PGIS1_SFCGAL_CHECKOUT_SHA1 + +ARG PGIS1_CGAL_REPOSITORY +ENV PGIS1_CGAL_REPOSITORY ${PGIS1_CGAL_REPOSITORY} +ARG PGIS1_CGAL_CHECKOUT +ENV PGIS1_CGAL_CHECKOUT ${PGIS1_CGAL_CHECKOUT} +ARG PGIS1_CGAL_CHECKOUT_SHA1 + +RUN set -eux \ && cd /usr/src \ - && git clone --branch ${CGAL_GIT_BRANCH} https://github.com/CGAL/cgal \ + && mkdir cgal \ && cd cgal \ - && git checkout ${CGAL5X_GIT_HASH} \ + && git init \ + && git remote add origin ${PGIS1_CGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_CGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_CGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_CGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_CGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_CGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping CGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_CGAL_CHECKOUT_SHA1}" ]; then \ + echo "CGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ && git log -1 > /_pgis_cgal_last_commit.txt \ && cd /usr/src \ - && git clone https://gitlab.com/Oslandia/SFCGAL.git \ + && mkdir SFCGAL \ && cd SFCGAL \ - && git checkout ${SFCGAL_GIT_HASH} \ + && git init \ + && git remote add origin ${PGIS1_SFCGAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_SFCGAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_SFCGAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_SFCGAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_SFCGAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping SFCGAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_SFCGAL_CHECKOUT_SHA1}" ]; then \ + echo "SFCGAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ && git log -1 > /_pgis_sfcgal_last_commit.txt \ && mkdir cmake-build \ && cd cmake-build \ && cmake .. \ -DCGAL_DIR=/usr/src/cgal \ - -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ -DSFCGAL_BUILD_BENCH=OFF \ -DSFCGAL_BUILD_EXAMPLES=OFF \ -DSFCGAL_BUILD_TESTS=OFF \ -DSFCGAL_WITH_OSG=OFF \ && make -j$(nproc) \ && make install \ - # - ## testing with -DSFCGAL_BUILD_TESTS=ON - # && CTEST_OUTPUT_ON_FAILURE=TRUE ctest \ - # # clean && rm -fr /usr/src/SFCGAL \ && rm -fr /usr/src/cgal + +FROM builder as proj-builder + # proj -ENV PROJ_GIT_HASH %%PROJ_GIT_HASH%% -RUN set -ex \ +ARG PGIS1_PROJ_REPOSITORY +ENV PGIS1_PROJ_REPOSITORY ${PGIS1_PROJ_REPOSITORY} +ARG PGIS1_PROJ_CHECKOUT +ENV PGIS1_PROJ_CHECKOUT ${PGIS1_PROJ_CHECKOUT} +ARG PGIS1_PROJ_CHECKOUT_SHA1 + +RUN set -eux \ && cd /usr/src \ - && git clone https://github.com/OSGeo/PROJ.git \ + && mkdir PROJ \ && cd PROJ \ - && git checkout ${PROJ_GIT_HASH} \ + && git init \ + && git remote add origin ${PGIS1_PROJ_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_PROJ_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_PROJ_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_PROJ_CHECKOUT_SHA1 + && if [ -z "${PGIS1_PROJ_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_PROJ_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping PROJ SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_PROJ_CHECKOUT_SHA1}" ]; then \ + echo "PROJ SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ && git log -1 > /_pgis_proj_last_commit.txt \ # check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027 && if [ -f "autogen.sh" ] ; then \ @@ -143,7 +223,7 @@ RUN set -ex \ && echo "cmake version: 'autogen.sh' does not exists! Newer version!" \ && mkdir build \ && cd build \ - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ && make -j$(nproc) \ && make install \ ; \ @@ -151,29 +231,134 @@ RUN set -ex \ \ && rm -fr /usr/src/PROJ + +FROM builder as geos-builder + # geos -ENV GEOS_GIT_HASH %%GEOS_GIT_HASH%% -RUN set -ex \ +ARG PGIS1_GEOS_REPOSITORY +ENV PGIS1_GEOS_REPOSITORY ${PGIS1_GEOS_REPOSITORY} +ARG PGIS1_GEOS_CHECKOUT +ENV PGIS1_GEOS_CHECKOUT ${PGIS1_GEOS_CHECKOUT} +ARG PGIS1_GEOS_CHECKOUT_SHA1 + +RUN set -eux \ && cd /usr/src \ - && git clone https://github.com/libgeos/geos.git \ + && mkdir geos \ && cd geos \ - && git checkout ${GEOS_GIT_HASH} \ + && git init \ + && git remote add origin ${PGIS1_GEOS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GEOS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GEOS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GEOS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GEOS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GEOS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GEOS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GEOS_CHECKOUT_SHA1}" ]; then \ + echo "GEOS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ && git log -1 > /_pgis_geos_last_commit.txt \ && mkdir cmake-build \ && cd cmake-build \ - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ && make -j$(nproc) \ && make install \ && cd / \ && rm -fr /usr/src/geos + +FROM builder as stage0-builder + +COPY --from=cgal-sfcgal-builder /_pgis*.* / +COPY --from=cgal-sfcgal-builder /usr/local /usr/local + +COPY --from=proj-builder /_pgis*.* / +COPY --from=proj-builder /usr/local /usr/local + +COPY --from=geos-builder /_pgis*.* / +COPY --from=geos-builder /usr/local /usr/local # gdal -ENV GDAL_GIT_HASH %%GDAL_GIT_HASH%% -RUN set -ex \ +ARG PGIS1_GDAL_REPOSITORY +ENV PGIS1_GDAL_REPOSITORY ${PGIS1_GDAL_REPOSITORY} +ARG PGIS1_GDAL_CHECKOUT +ENV PGIS1_GDAL_CHECKOUT ${PGIS1_GDAL_CHECKOUT} +ARG PGIS1_GDAL_CHECKOUT_SHA1 + + +{{ if .[env.variant].GDAL_BUILD != "minimal" then ( -}} + +# Install Arrow C++ +# also check the "Build final image" section too, for the final installation +RUN set -eux \ + # add backports \ + && apt-get update \ + && apt install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-{{ env.variant }}.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-{{ env.variant }}.deb \ + && apt-get update \ + # Automatically determine the latest PGIS1 Arrow version and SOVERSION + && apt-cache showpkg libarrow-dev \ + && PGIS1_ARROW_VERSION=$(apt-cache showpkg libarrow-dev | grep -m1 'Versions:' -A1 | tail -n1 | grep -oP '^\S+') \ + && apt-cache depends libarrow-dev=${PGIS1_ARROW_VERSION} | tee /_pgis1_libarrow-dev-dependencies.txt \ + && PGIS1_ARROW_SOVERSION=$(grep 'Depends: libarrow' /_pgis1_libarrow-dev-dependencies.txt | grep -oP 'libarrow\K[0-9]+') \ + && echo "Detected PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" \ + && echo "Detected PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + # Backup the version variables - reusing in a later stage + && echo "PGIS1_ARROW_VERSION=$PGIS1_ARROW_VERSION" > /_pgis1_arrow_environment.env \ + && echo "PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" >> /_pgis1_arrow_environment.env \ + # Install Arrow C++ + && apt-get install -y --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + libarrow-dev=${PGIS1_ARROW_VERSION} \ + libparquet-dev=${PGIS1_ARROW_VERSION} \ + libarrow-acero-dev=${PGIS1_ARROW_VERSION} \ + libarrow-dataset-dev=${PGIS1_ARROW_VERSION} \ + \ + libblosc-dev \ + libcfitsio-dev \ + libfreexl-dev \ + libfyba-dev \ + libhdf5-dev \ + libheif-dev \ + libkml-dev \ + libnetcdf-dev \ + libopenjp2-7-dev \ + libpng-dev \ + libqhull-dev \ + libspatialite-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +{{ ) else ( -}} +# +{{ ) end -}} + +## GDAL_build-end + +RUN set -eux \ + && ldconfig \ && cd /usr/src \ - && git clone https://github.com/OSGeo/gdal.git \ + && mkdir gdal \ && cd gdal \ - && git checkout ${GDAL_GIT_HASH} \ + && git init \ + && git remote add origin ${PGIS1_GDAL_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_GDAL_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_GDAL_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_GDAL_CHECKOUT_SHA1 + && if [ -z "${PGIS1_GDAL_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_GDAL_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping GDAL SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_GDAL_CHECKOUT_SHA1}" ]; then \ + echo "GDAL SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ && git log -1 > /_pgis_gdal_last_commit.txt \ \ # gdal project directory structure - has been changed ! @@ -196,39 +381,48 @@ RUN set -ex \ && mkdir build \ && cd build \ # config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules - && cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \ + && cmake .. \ + -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + -DBUILD_TESTING=OFF \ -DBUILD_DOCS=OFF \ \ -DGDAL_HIDE_INTERNAL_SYMBOLS=ON \ -DRENAME_INTERNAL_TIFF_SYMBOLS=ON \ - -DGDAL_USE_BLOSC=ON \ - -DGDAL_USE_CFITSIO=ON \ -DGDAL_USE_CURL=ON \ -DGDAL_USE_DEFLATE=ON \ -DGDAL_USE_EXPAT=ON \ - -DGDAL_USE_FREEXL=ON \ - -DGDAL_USE_FYBA=ON \ -DGDAL_USE_GEOS=ON \ - -DGDAL_USE_HDF5=ON \ -DGDAL_USE_JSONC=ON \ - -DGDAL_USE_LERC_INTERNAL=ON \ - -DGDAL_USE_LIBKML=ON \ -DGDAL_USE_LIBLZMA=ON \ + -DGDAL_USE_LIBXML2=ON \ -DGDAL_USE_LZ4=ON \ - -DGDAL_USE_OPENJPEG=ON \ -DGDAL_USE_POSTGRESQL=ON \ - -DGDAL_USE_QHULL=ON \ -DGDAL_USE_SQLITE3=ON \ -DGDAL_USE_TIFF=ON \ -DGDAL_USE_WEBP=ON \ + -DGDAL_USE_ZLIB=ON \ -DGDAL_USE_ZSTD=ON \ +{{ if .[env.variant].GDAL_BUILD != "minimal" then ( -}} \ - # OFF and Not working https://github.com/OSGeo/gdal/issues/7100 - # -DRENAME_INTERNAL_GEOTIFF_SYMBOLS=ON \ - -DGDAL_USE_ECW=OFF \ - -DGDAL_USE_GEOTIFF=OFF \ - -DGDAL_USE_HEIF=OFF \ - -DGDAL_USE_SPATIALITE=OFF \ + -DGDAL_USE_ARROW=ON \ + -DGDAL_USE_ARROWDATASET=ON \ + -DGDAL_USE_BLOSC=ON \ + -DGDAL_USE_CFITSIO=ON \ + -DGDAL_USE_FREEXL=ON \ + -DGDAL_USE_FYBA=ON \ + -DGDAL_USE_HDF5=ON \ + -DGDAL_USE_HEIF=ON \ + -DGDAL_USE_LERC_INTERNAL=ON \ + -DGDAL_USE_LIBKML=ON \ + -DGDAL_USE_NETCDF=ON \ + -DGDAL_USE_OPENJPEG=ON \ + -DGDAL_USE_PARQUET=ON \ + -DGDAL_USE_PNG=ON \ + -DGDAL_USE_QHULL=ON \ + -DGDAL_USE_SPATIALITE=ON \ +{{ ) else ( -}} +# minimal GDAL build .. +{{ ) end -}} ; \ fi \ \ @@ -238,7 +432,7 @@ RUN set -ex \ && rm -fr /usr/src/gdal # Minimal command line test. -RUN set -ex \ +RUN set -eux \ && ldconfig \ && cs2cs \ && ldd $(which gdalinfo) \ @@ -250,27 +444,37 @@ RUN set -ex \ && pcre-config --version # ------------------------------------------- -# STAGE final +# final stage # ------------------------------------------- -FROM postgres:%%PG_MAJOR%%-%%DEBIAN_VERSION%% +FROM ${PGIS1_BASE_IMAGE} + +LABEL maintainer="PostGIS Project - https://postgis.net" \ + org.opencontainers.image.description="PostGIS - {{ env.version }} spatial database extension with PostgreSQL {{ .[env.variant].PG_MAJOR }} {{ env.variant }}" \ + org.opencontainers.image.source="https://github.com/postgis/docker-postgis" + +ARG PGIS1_CMAKE_BUILD_TYPE +ARG PGIS1_BASE_IMAGE +ARG PGIS1_BOOST_VERSION -ARG DOCKER_CMAKE_BUILD_TYPE -ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} +ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \ + PGIS1_BASE_IMAGE=${PGIS1_BASE_IMAGE} \ + PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION} -RUN set -ex \ +RUN set -eux \ && apt-get update \ - && apt-get install -y --no-install-recommends \ + && apt-get install -y -V --no-install-recommends \ + \ curl \ - libboost-atomic%%BOOST_VERSION%% \ - libboost-chrono%%BOOST_VERSION%% \ - libboost-date-time%%BOOST_VERSION%% \ - libboost-filesystem%%BOOST_VERSION%% \ - libboost-program-options%%BOOST_VERSION%% \ - libboost-serialization%%BOOST_VERSION%% \ - libboost-system%%BOOST_VERSION%% \ - libboost-test%%BOOST_VERSION%% \ - libboost-thread%%BOOST_VERSION%% \ - libboost-timer%%BOOST_VERSION%% \ + libboost-atomic${PGIS1_BOOST_VERSION} \ + libboost-chrono${PGIS1_BOOST_VERSION} \ + libboost-date-time${PGIS1_BOOST_VERSION} \ + libboost-filesystem${PGIS1_BOOST_VERSION} \ + libboost-program-options${PGIS1_BOOST_VERSION} \ + libboost-serialization${PGIS1_BOOST_VERSION} \ + libboost-system${PGIS1_BOOST_VERSION} \ + libboost-test${PGIS1_BOOST_VERSION} \ + libboost-thread${PGIS1_BOOST_VERSION} \ + libboost-timer${PGIS1_BOOST_VERSION} \ libcurl3-gnutls \ libexpat1 \ libgmp10 \ @@ -279,36 +483,97 @@ RUN set -ex \ libmpfr6 \ libpcre3 \ libprotobuf-c1 \ +{{ if env.variant != "bullseye" then ( -}} + libtiff6 \ +{{ ) else ( -}} libtiff5 \ +{{ ) end -}} libxml2 \ sqlite3 \ - # gdal+ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=stage0-builder /_pgis*.* / +COPY --from=stage0-builder /usr/local /usr/local + +{{ if .[env.variant].GDAL_BUILD != "minimal" then ( -}} +# Install Arrow + Parquet + other GDAL extra dependencies + +RUN set -eux \ + # Install Arrow + Parquet + && apt-get update \ + && apt-get install -y -V ca-certificates wget \ + && wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-{{ env.variant }}.deb \ + && apt-get install -y -V ./apache-arrow-apt-source-latest-{{ env.variant }}.deb \ + && apt-get update \ + # Load the PGIS1_ARROW version variables + && . /_pgis1_arrow_environment.env \ + # Use the PGIS1_ARROW_SOVERSION as needed + && echo "Using PGIS1_ARROW_SOVERSION=$PGIS1_ARROW_SOVERSION" \ + && apt-get install -y -V --no-install-recommends \ + libarrow${PGIS1_ARROW_SOVERSION} \ + libparquet${PGIS1_ARROW_SOVERSION} \ + libarrow-dataset${PGIS1_ARROW_SOVERSION} \ + \ + # Install GDAL extra dependencies libblosc1 \ - libcfitsio9 \ + libcrypto++8 \ libfreexl1 \ libfyba0 \ libhdf5-103-1 \ + libheif1 \ libkmlbase1 \ libkmldom1 \ libkmlengine1 \ + libnetcdf19 \ libopenjp2-7 \ + libpng16-16 \ libqhull-r8.0 \ + librasterlite2-1 \ + libspatialite7 \ + netcdf-bin \ +{{ if env.variant != "bullseye" then ( -}} + libcfitsio10 \ +{{ ) else ( -}} + libcfitsio9 \ +{{ ) end -}} && apt-get clean \ && rm -rf /var/lib/apt/lists/* +{{ ) else ( -}} +# minimal GDAL build; so no need extra dependencies +{{ ) end -}} + -COPY --from=builder /_pgis*.* / -COPY --from=builder /usr/local /usr/local +ARG PGIS1_GDAL_CHECKOUT +ARG PGIS1_GDAL_REPOSITORY +ARG PGIS1_GEOS_CHECKOUT +ARG PGIS1_GEOS_REPOSITORY +ARG PGIS1_PROJ_CHECKOUT +ARG PGIS1_PROJ_REPOSITORY +ARG PGIS1_SFCGAL_CHECKOUT +ARG PGIS1_SFCGAL_REPOSITORY +ARG PGIS1_CGAL_REPOSITORY +ARG PGIS1_CGAL_CHECKOUT -ARG CGAL_GIT_BRANCH -ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL5X_GIT_HASH %%CGAL5X_GIT_HASH%% -ENV SFCGAL_GIT_HASH %%SFCGAL_GIT_HASH%% -ENV PROJ_GIT_HASH %%PROJ_GIT_HASH%% -ENV GEOS_GIT_HASH %%GEOS_GIT_HASH%% -ENV GDAL_GIT_HASH %%GDAL_GIT_HASH%% +ARG PGIS1_POSTGIS_CHECKOUT +ARG PGIS1_POSTGIS_REPOSITORY +ARG PGIS1_POSTGIS_CHECKOUT_SHA1 + +ENV PGIS1_GDAL_CHECKOUT=${PGIS1_GDAL_CHECKOUT} \ + PGIS1_GDAL_REPOSITORY=${PGIS1_GDAL_REPOSITORY} \ + PGIS1_GEOS_CHECKOUT=${PGIS1_GEOS_CHECKOUT} \ + PGIS1_GEOS_REPOSITORY=${PGIS1_GEOS_REPOSITORY} \ + PGIS1_PROJ_CHECKOUT=${PGIS1_PROJ_CHECKOUT} \ + PGIS1_PROJ_REPOSITORY=${PGIS1_PROJ_REPOSITORY} \ + PGIS1_CGAL_CHECKOUT=${PGIS1_CGAL_CHECKOUT} \ + PGIS1_CGAL_REPOSITORY=${PGIS1_CGAL_REPOSITORY} \ + PGIS1_SFCGAL_CHECKOUT=${PGIS1_SFCGAL_CHECKOUT} \ + PGIS1_SFCGAL_REPOSITORY=${PGIS1_SFCGAL_REPOSITORY} \ + PGIS1_POSTGIS_CHECKOUT=${PGIS1_POSTGIS_CHECKOUT} \ + PGIS1_POSTGIS_REPOSITORY=${PGIS1_POSTGIS_REPOSITORY} # Minimal command line test ( fail fast ) -RUN set -ex \ +RUN set -eux \ && ldconfig \ && cs2cs \ && ldd $(which gdalinfo) \ @@ -323,10 +588,17 @@ RUN set -ex \ && ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 -# install postgis -ENV POSTGIS_GIT_HASH %%POSTGIS_GIT_HASH%% +# Specify GDAL_CONFIG and LD_LIBRARY_PATH for PostGIS build; +# The arm64 build is very senitive. +ENV GDAL_CONFIG /usr/local/bin/gdal-config +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +# temporary workaround for : nitdb: invalid locale settings; check LANG and LC_* environment variables +# https://github.com/docker-library/postgres/issues/1112#issuecomment-1746076388 +RUN set -eux \ + && echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen -RUN set -ex \ +RUN set -eux \ && apt-get update \ && apt-get install -y --no-install-recommends \ autoconf \ @@ -360,11 +632,26 @@ RUN set -ex \ xsltproc \ && cd \ # postgis - && cd /usr/src/ \ - && git clone https://github.com/postgis/postgis.git \ + && cd /usr/src \ + && mkdir postgis \ && cd postgis \ - && git checkout ${POSTGIS_GIT_HASH} \ + && git init \ + && git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \ + && git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \ + && git checkout FETCH_HEAD \ + # Skip SHA1 check if PGIS1_POSTGIS_CHECKOUT_SHA1 is empty or 'nocheck' + # Otherwise, verify that the commit hash matches PGIS1_POSTGIS_CHECKOUT_SHA1 + && if [ -z "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ] \ + || [ "${PGIS1_POSTGIS_CHECKOUT_SHA1}" = "nocheck" ]; then \ + echo "Skipping POSTGIS SHA1 check"; \ + else \ + if [ "$(git rev-parse HEAD)" != "${PGIS1_POSTGIS_CHECKOUT_SHA1}" ]; then \ + echo "POSTGIS SHA1 problem! Stop!"; \ + exit 1; \ + fi; \ + fi \ && git log -1 > /_pgis_last_commit.txt \ + && ldconfig \ && ./autogen.sh \ # configure options taken from: # https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie @@ -373,10 +660,12 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ # refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316 - && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ - && projsync --system-directory --file us_noaa_eshpgn \ - && projsync --system-directory --file us_noaa_prvi \ - && projsync --system-directory --file us_noaa_wmhpgn \ + && if command -v projsync >/dev/null 2>&1; then \ + projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ + && projsync --system-directory --file us_noaa_eshpgn \ + && projsync --system-directory --file us_noaa_prvi \ + && projsync --system-directory --file us_noaa_wmhpgn ; \ + fi \ # regress check && mkdir /tempdb \ && chown -R postgres:postgres /tempdb \ @@ -441,7 +730,7 @@ COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh COPY ./update-postgis.sh /usr/local/bin # last final test -RUN set -ex \ +RUN set -eux \ && ldconfig \ && cs2cs \ && ldd $(which gdalinfo) \ @@ -451,12 +740,14 @@ RUN set -ex \ && ogr2ogr --version \ && proj \ && sfcgal-config --version \ + # check any missing dependencies + && ldd /usr/lib/postgresql/$PG_MAJOR/lib/*.so | grep 'not found' && exit 1 || true \ \ # Is the "ca-certificates" package installed? (for accessing remote raster files) # https://github.com/postgis/docker-postgis/issues/307 && dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \ \ # list last commits. - && find /_pgis_*_last_commit.txt -type f -print -exec cat {} \; \ + && find /_pgis*_commit.txt -type f -print -exec cat {} \; \ # list postgresql, postgis version && cat _pgis_full_version.txt diff --git a/Dockerfile.template b/Dockerfile.template deleted file mode 100644 index cc3cd277..00000000 --- a/Dockerfile.template +++ /dev/null @@ -1,28 +0,0 @@ -# -# %%TXT_AUTOGENERATED%% -# - -FROM postgres:%%PG_MAJOR%%-%%DEBIAN_VERSION%% - -LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS %%POSTGIS_VERSION%% spatial database extension with PostgreSQL %%PG_MAJOR%% %%DEBIAN_VERSION%%" \ - org.opencontainers.image.source="https://github.com/postgis/docker-postgis" - -ENV POSTGIS_MAJOR %%POSTGIS_MAJOR%% -ENV POSTGIS_VERSION %%POSTGIS_VERSION%% - -RUN apt-get update \ - && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ - && apt-get install -y --no-install-recommends \ - # ca-certificates: for accessing remote raster files; - # fix: https://github.com/postgis/docker-postgis/issues/307 - ca-certificates \ - \ - postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ - postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ - && rm -rf /var/lib/apt/lists/* - -RUN mkdir -p /docker-entrypoint-initdb.d -COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh -COPY ./update-postgis.sh /usr/local/bin - diff --git a/Makefile b/Makefile index d8e7c674..040f3b2d 100644 --- a/Makefile +++ b/Makefile @@ -1,151 +1,372 @@ +# The registry, repository and image names default to the official but can be overriden +# via environment variables. +# For testing, You can start a local registry with: +# docker run -d -p 5000:5000 --restart=always --name registry registry:2 +# with REGISTRY ?= localhost:5000 -# When processing the rules for tagging and pushing container images with the -# "latest" tag, the following variable will be the version that is considered -# to be the latest. -LATEST_VERSION=16-3.4 - -# The following flags are set based on VERSION and VARIANT environment variables -# that may have been specified, and are used by rules to determine which -# versions/variants are to be processed. If no VERSION or VARIANT environment -# variables were specified, process everything (the default). -do_default=true -do_alpine=true - -# The following logic evaluates VERSION and VARIANT variables that may have -# been previously specified, and modifies the "do" flags depending on the values. -# The VERSIONS variable is also set to contain the version(s) to be processed. -ifdef VERSION - VERSIONS=$(VERSION) # If a version was specified, VERSIONS only contains the specified version - ifdef VARIANT # If a variant is specified, unset all do flags and allow subsequent logic to set them again where appropriate - do_default=false - do_alpine=false - ifeq ($(VARIANT),default) - do_default=true - endif - ifeq ($(VARIANT),alpine) - do_alpine=true - endif - endif - ifeq ("$(wildcard $(VERSION)/alpine)","") # If no alpine subdirectory exists, don't process the alpine version - do_alpine=false - endif -else # If no version was specified, VERSIONS should contain all versions - VERSIONS = $(foreach df,$(wildcard */Dockerfile),$(df:%/Dockerfile=%)) -endif - -# The "latest" tag will only be provided for default images (no variant) so -# only define the dependencies when the default image will be built. -ifeq ($(do_default),true) - BUILD_LATEST_DEP=build-$(LATEST_VERSION) - PUSH_LATEST_DEP=push-$(LATEST_VERSION) - PUSH_DEP=push-latest $(PUSH_LATEST_DEP) - # The "latest" tag shouldn't be processed if a VERSION was explicitly - # specified but does not correspond to the latest version. - ifdef VERSION - ifneq ($(VERSION),$(LATEST_VERSION)) - PUSH_LATEST_DEP= - BUILD_LATEST_DEP= - PUSH_DEP= - endif - endif +ENVFILE = .env +ifeq ($(TEST),true) + ENVFILE = .env.test endif +-include $(ENVFILE) +export -# The repository and image names default to the official but can be overriden -# via environment variables. +REGISTRY ?= docker.io REPO_NAME ?= postgis IMAGE_NAME ?= postgis -DOCKER=docker -DOCKERHUB_DESC_IMG=peterevans/dockerhub-description:latest +ifeq ($(shell uname -m),x86_64) + IMAGE_ARCH=amd64 +else ifeq ($(shell uname -m),aarch64) + IMAGE_ARCH=arm64 +else + $(error Architecture not supported) +endif -GIT=git -OFFIMG_LOCAL_CLONE=$(HOME)/official-images -OFFIMG_REPO_URL=https://github.com/docker-library/official-images.git +PUBLIC_IMAGE_NAME:=$(IMAGE_NAME) +ifeq ($(ENABLE_IMAGE_ARCH),true) + IMAGE_NAME:=$(IMAGE_NAME)-$(IMAGE_ARCH) +endif +IMAGE_VERSION_ID :="" +ifeq ($(ENABLE_IMAGE_VERSION_ID),true) + # Note: Make sure to keep this synchronized with the corresponding section in ./tools/environment_init.sh + COMMIT_DATE=$(shell git log -1 --format=%cd --date=format:%Y%m%d) + COMMIT_HASH=$(shell git log -1 --pretty=format:%h) + BUILD_WEEK=$(shell date '+%Yw%V') + IMAGE_VERSION_ID=-ver$(COMMIT_DATE)-$(COMMIT_HASH)-$(BUILD_WEEK) +endif -build: $(foreach version,$(VERSIONS),build-$(version)) +PUSH_FULL_IMAGENAME = ;$(DOCKER) image push $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME): +FULL_IMAGENAME_WITH_T = -t $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME): -all: update build test +DOCKER ?=docker +DOCKERHUB_DESC_IMG=peterevans/dockerhub-description:latest +DOCKER_BUILDOPT ?= --network=host --progress=plain -update: - $(DOCKER) run --rm -v $$(pwd):/work -w /work buildpack-deps ./update.sh +GIT ?=git +OFFIMG_LOCAL_CLONE ?=$(HOME)/official-images +OFFIMG_REPO_URL ?=https://github.com/docker-library/official-images.git +# Default target: help +.DEFAULT_GOAL := help -### RULES FOR BUILDING ### +# Dynamically determine versions and variants based on +# the existence of Dockerfile at the depth of two directories +# where the first directory names starting with a number. +DOCKERFILE_DIRS := $(shell find . -mindepth 2 -maxdepth 2 -type d -exec test -e '{}/Dockerfile' \; -print | sed 's|./||' | awk '/^[0-9]/ {print}') +VERSIONS := $(sort $(shell echo '$(DOCKERFILE_DIRS)' | tr ' ' '\n' | cut -d'/' -f1)) +VARIANTS := $(sort $(shell echo '$(DOCKERFILE_DIRS)' | tr ' ' '\n' | cut -d'/' -f2)) -define build-version -build-$1: -ifeq ($(do_default),true) - $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1 - $(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) -endif -ifeq ($(do_alpine),true) -ifneq ("$(wildcard $1/alpine)","") - $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine - $(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine +check_variant: +ifeq ($(VARIANT),default) + $(error VARIANT is set to 'default', which is not allowed!) endif +ifeq ($(VARIANT),alpine) + $(error VARIANT is set to 'alpine', which is not allowed!) endif + +# Build targets for each version-variant combination +define build-target +build-$(1)-$(2): check_variant \ + $(if $(filter 2,$(shell echo $(1) | grep -o '-' | wc -l)),build-$(shell echo $(1) | cut -d- -f1,2)-$(2)) + @echo '::Building $(FULL_IMAGENAME_WITH_T)$(1)-$(2) $(IMAGE_VERSION_ID)' + @echo ':::::: dependency: $(if $(filter 2,$(shell echo $(1) | grep -o '-' | wc -l)),build-$(shell echo $(1) | cut -d- -f1,2)-$(2)) ' + $(DOCKER) build $(DOCKER_BUILDOPT) \ + --build-arg="REGISTRY=$(REGISTRY)" \ + --build-arg="REPO_NAME=$(REPO_NAME)" \ + --build-arg="IMAGE_NAME=$(IMAGE_NAME)" \ + $(if $(filter 1,$(shell echo $(1) | grep -o '-' | wc -l)), --pull ) \ + $(shell cat $(1)/$(2)/tags | sed 's#\([a-zA-Z0-9.-]*\)#$(subst $,,$(FULL_IMAGENAME_WITH_T))\1#g' ) \ + $(if $(IMAGE_VERSION_ID),$(shell cat $(1)/$(2)/tags | sed 's#\([a-zA-Z0-9.-]*\)#$(subst $,,$(FULL_IMAGENAME_WITH_T))\1$(IMAGE_VERSION_ID)#g' ),) \ + $(1)/$(2) + $(DOCKER) image ls $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME):$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) + $(DOCKER) image ls $(REPO_NAME)/$(IMAGE_NAME):$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) + $(DOCKER) image inspect $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME):$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) endef -$(foreach version,$(VERSIONS),$(eval $(call build-version,$(version)))) +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call build-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) + +# Build targets for each version +define build-version-target +build-$(1): $(shell echo '$(DOCKERFILE_DIRS)' | tr ' ' '\n' | grep ^$(1)/ | sed 's|$(1)/|build-$(1)-|') +endef +$(foreach version,$(VERSIONS),$(eval $(call build-version-target,$(version)))) +# General build target +build: $(foreach dir,$(DOCKERFILE_DIRS),build-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))) -## RULES FOR TESTING ### +# -------------------------------------------------- test-prepare: ifeq ("$(wildcard $(OFFIMG_LOCAL_CLONE))","") + @echo '::Cloning official-images $(OFFIMG_LOCAL_CLONE)' $(GIT) clone $(OFFIMG_REPO_URL) $(OFFIMG_LOCAL_CLONE) +else + @echo '::Updating official-images : $(OFFIMG_LOCAL_CLONE)' + cd $(OFFIMG_LOCAL_CLONE) && $(GIT) pull origin master endif -test: $(foreach version,$(VERSIONS),test-$(version)) +# Test targets for each version-variant combination +define test-target +test-$(1)-$(2): test-prepare \ + build-$1-$(2) \ + $(if $(filter 2,$(shell echo $(1) | grep -o '-' | wc -l)),test-$(shell echo $(1) | cut -d- -f1,2)-$(2)) + @echo ':Testing $(1)/$(2)' - $(shell cat $(1)/$(2)/tags | cut -d' ' -f1) + @echo ':::::: dependency: $(if $(filter 2,$(shell echo $(1) | grep -o '-' | wc -l)),test-$(shell echo $(1) | cut -d- -f1,2)-$(2)) ' + $(OFFIMG_LOCAL_CLONE)/test/run.sh \ + -c $(OFFIMG_LOCAL_CLONE)/test/config.sh \ + -c test/postgis-config.sh \ + $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME):$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) -define test-version -test-$1: test-prepare build-$1 -ifeq ($(do_default),true) - $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version) -endif -ifeq ($(do_alpine),true) -ifneq ("$(wildcard $1/alpine)","") - $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine -endif -endif endef -$(foreach version,$(VERSIONS),$(eval $(call test-version,$(version)))) +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call test-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) +# Build targets for each version +define test-version-target +test-$(1): $(shell echo '$(DOCKERFILE_DIRS)' | tr ' ' '\n' | grep ^$(1)/ | sed 's|$(1)/|test-$(1)-|') +endef +$(foreach version,$(VERSIONS),$(eval $(call test-version-target,$(version)))) +# General test target +test: $(foreach dir,$(DOCKERFILE_DIRS),test-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))) -### RULES FOR TAGGING ### +# -------------------------------------------------- +# Push targets for each version-variant combination +define push-target +push-$(1)-$(2): $(if $(filter 2,$(shell echo $(1) | grep -o '-' | wc -l)),push-$(shell echo $(1) | cut -d- -f1,2)-$(2)) + @echo '::push $(1)/$(2)' + # push all image tags + $(foreach tag,$(shell cat $(1)/$(2)/tags), \ + echo " --> push1: $(tag) " && \ + $(DOCKER) image push $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME):$(tag) ; \ + ) -tag-latest: $(BUILD_LATEST_DEP) - $(DOCKER) image tag $(REPO_NAME)/$(IMAGE_NAME):$(LATEST_VERSION) $(REPO_NAME)/$(IMAGE_NAME):latest + $(if $(IMAGE_VERSION_ID), \ + # push all image tags - with version id ( -verYYYYMMDD-XXXXXX-YYYYwW W) + $(foreach tag,$(shell cat $(1)/$(2)/tags), \ + echo " --> push2: $(tag)$(IMAGE_VERSION_ID) " && \ + $(DOCKER) image push $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME):$(tag)$(IMAGE_VERSION_ID) ; \ + ),) +endef +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call push-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) +# Build targets for each version +define push-version-target +push-$(1): $(shell echo '$(DOCKERFILE_DIRS)' | tr ' ' '\n' | grep ^$(1)/ | sed 's|$(1)/|push-$(1)-|') +endef +$(foreach version,$(VERSIONS),$(eval $(call push-version-target,$(version)))) +# General push target +push: $(foreach dir,$(DOCKERFILE_DIRS),push-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))) -### RULES FOR PUSHING ### -push: $(foreach version,$(VERSIONS),push-$(version)) $(PUSH_DEP) +# -------------------------------------------------- +# Manifest targets for each version-variant combination +define manifest-target +manifest-$(1)-$(2): $(if $(filter 2,$(shell echo $(1) | grep -o '-' | wc -l)),manifest-$(shell echo $(1) | cut -d- -f1,2)-$(2)) + @echo '::Manifest $(1)/$(2)' + $(foreach tag,$(shell cat $(1)/$(2)/tags), \ + echo " --> manifest: $(1)/$(2):$(tag) " && \ + manifest-tool \ + $(if $(findstring localhost,$(REGISTRY)),--insecure --plain-http) \ + push from-args \ + --platforms linux/amd64,linux/arm64 \ + --template $(REGISTRY)/$(REPO_NAME)/$(PUBLIC_IMAGE_NAME)-ARCHVARIANT:$(tag) \ + --target $(REGISTRY)/$(REPO_NAME)/$(PUBLIC_IMAGE_NAME):$(tag) || true; \ + ) +endef +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call manifest-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) -define push-version -push-$1: test-$1 -ifeq ($(do_default),true) - $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version) -endif -ifeq ($(do_alpine),true) -ifneq ("$(wildcard $1/alpine)","") - $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine -endif -endif +# Manifest targets for each version +define manifest-version-target +manifest-$(1): $(shell echo '$(DOCKERFILE_DIRS)' | tr ' ' '\n' | grep ^$(1)/ | sed 's|$(1)/|manifest-$(1)-|') endef -$(foreach version,$(VERSIONS),$(eval $(call push-version,$(version)))) +$(foreach version,$(VERSIONS),$(eval $(call manifest-version-target,$(version)))) +# General manifest target +manifest: $(foreach dir,$(DOCKERFILE_DIRS),manifest-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))) + + + +# -------------------------------------------------- +push-readme: + @echo 'Docker pull $(DOCKERHUB_DESC_IMG)' + $(DOCKER) pull $(DOCKERHUB_DESC_IMG); + @echo 'Docker push README $(DOCKERHUB_DESC_IMG)' + @echo 'DOCKERHUB_REPOSITORY="$(DOCKERHUB_README_REPOSITORY)"' + $(DOCKER) run -v "$(PWD)":/workspace \ + -e DOCKERHUB_USERNAME="$(DOCKERHUB_USERNAME)" \ + -e DOCKERHUB_PASSWORD="$(DOCKERHUB_ACCESS_TOKEN)" \ + -e DOCKERHUB_REPOSITORY="$(DOCKERHUB_README_REPOSITORY)" \ + -e README_FILEPATH="/workspace/README.md" $(DOCKERHUB_DESC_IMG); + + +#---------------------------------------------------------- +define scan-target +scan-$(1)-$(2): + $(DOCKER) run \ + --pull always --rm -v $$(pwd)/trivy_cache:/root/.cache/ \ + ghcr.io/aquasecurity/trivy:latest image --ignore-unfixed \ + $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME):$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) +endef +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call scan-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) +# -------------------------------------------------- + +#---------------------------------------------------------- +define dive-target +dive-$(1)-$(2): + CI=true tools/dive \ + $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME):$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) +endef +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call dive-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) +# -------------------------------------------------- + + +# -------------------------------------------------- +# password: f62ba0 == echo -n "postgis" | md5sum | cut -c 1-6 +define start-target +start-$(1)-$(2): + $(DOCKER) run \ + --name postgis-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) \ + -e POSTGRES_PASSWORD="pwf62ba0-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1)" \ + -v postgisdataf62ba0-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1):/var/lib/postgresql/data \ + -d $(REGISTRY)/$(REPO_NAME)/$(IMAGE_NAME):$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) +endef +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call start-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) +# -------------------------------------------------- +define stop-target +stop-$(1)-$(2): + $(DOCKER) stop postgis-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) +endef +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call stop-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) +# -------------------------------------------------- +define psql-target +psql-$(1)-$(2): + $(DOCKER) exec -ti postgis-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1) psql -U postgres +endef +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call psql-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) +# -------------------------------------------------- +define clean-target +clean-$(1)-$(2): + @if [ "$$(docker ps -a -q -f name=postgis-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1))" ]; then \ + $(DOCKER) rm $$(docker ps -a -q -f name=postgis-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1)); \ + else \ + echo "No such container to remove : postgis-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1)"; \ + fi + @if [ "$$(docker volume ls -q -f name=postgisdataf62ba0-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1))" ]; then \ + docker volume rm postgisdataf62ba0-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1); \ + else \ + echo "No such volume to remove : postgisdataf62ba0-$(shell cat $(1)/$(2)/tags | cut -d' ' -f1)"; \ + fi +endef +$(foreach dir,$(DOCKERFILE_DIRS),$(eval $(call clean-target,$(word 1,$(subst /, ,$(dir))),$(word 2,$(subst /, ,$(dir)))))) + +# docker rm $(docker ps -a -f name=changedetection.io -q) +# -------------------------------------------------- +all: check_variant update build test + +dockerlist: + docker images | grep "${REPO_NAME}/${IMAGE_NAME}" || true + +update: + @echo '::Updating Dockerfiles' + $(DOCKER) pull buildpack-deps + $(DOCKER) run --rm -v $$(pwd):/work -w /work buildpack-deps ./update.sh + +check-gh-rate: + @echo 'Checking github ratelimit ...' + @curl -sI https://api.github.com/users/octocat | grep x-ratelimit + +check_version: + @echo "ENABLE_IMAGE_ARCH=$(ENABLE_IMAGE_ARCH)" + @echo "ENABLE_IMAGE_VERSION_ID=$(ENABLE_IMAGE_VERSION_ID)" + @echo "IMAGE_ARCH=$(IMAGE_ARCH)" + @echo "IMAGE_VERSION_ID=$(IMAGE_VERSION_ID)" + +# Rule to run shellcheck on all .sh files in the current directory, subdirectories, and sub-subdirectories. +lint: + shellcheck *.sh ./*/*.sh ./*/*/*.sh ./*/*/*/*.sh -x + +shfmt: + shfmt -i 4 -w *.sh + shfmt -i 4 -w ./tools/*.sh + shfmt -i 4 -w ./test/*.sh + shfmt -i 4 -w ./test/tests/*/*.sh + +lregistryinfo: + echo " ---- Registry info ---- " + curl --location --silent --request GET "http://localhost:5000/v2/_catalog?page=1" | jq '.' + curl --location --silent --request GET "http://localhost:5000/v2/${REPO_NAME}/${IMAGE_NAME}/tags/list?page=1" | jq '.' + +# Remove all local images with the name localhost:5000/ and librarytest +# In a Makefile, the $ character has a special meaning, so you indeed need to escape it by using $$ instead of a single $. +imageclean: + docker image ls | grep "^librarytest" | awk '{print $$3}' | sort -u | xargs -rt docker rmi -f + docker image ls | grep "^localhost:5000/" | awk '{print $$3}' | sort -u | xargs -rt docker rmi -f -push-latest: tag-latest $(PUSH_LATEST_DEP) - $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):latest - @$(DOCKER) run -v "$(PWD)":/workspace \ - -e DOCKERHUB_USERNAME='$(DOCKERHUB_USERNAME)' \ - -e DOCKERHUB_PASSWORD='$(DOCKERHUB_ACCESS_TOKEN)' \ - -e DOCKERHUB_REPOSITORY='$(REPO_NAME)/$(IMAGE_NAME)' \ - -e README_FILEPATH='/workspace/README.md' $(DOCKERHUB_DESC_IMG) +imageclean_${REPO_NAME}_${IMAGE_NAME}: + docker image ls | grep "^${REPO_NAME}/${IMAGE_NAME}" | awk '{print $$3}' | sort -u | xargs -rt docker rmi -f +# Help target +help: check_variant + @echo ' Available make targets:' + @echo '------------------------------------ ' + @echo '# build : Build the docker image versions and variants' + @echo $(foreach version,$(VERSIONS),' build-$(version)') + @echo $(foreach dir,$(DOCKERFILE_DIRS),' build-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo ' ' + @echo '# test : Test the docker image versions and variants' + @echo $(foreach version,$(VERSIONS),' test-$(version)') + @echo $(foreach dir,$(DOCKERFILE_DIRS),' test-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo ' ' + @echo '# push : Push to the registry the docker image versions and variants' + @echo $(foreach version,$(VERSIONS),' push-$(version)') + @echo $(foreach dir,$(DOCKERFILE_DIRS),' push-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo ' ' + @echo '# manifest : Manifest registry the docker image versions and variants' + @echo $(foreach version,$(VERSIONS),' manifest-$(version)') + @echo $(foreach dir,$(DOCKERFILE_DIRS),' manifest-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo ' ' + @echo '# Scan the docker image, using aquasec/trivy' + @echo $(foreach dir,$(DOCKERFILE_DIRS),' scan-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo '# Dive the docker image, using wagoodman/dive' + @echo $(foreach dir,$(DOCKERFILE_DIRS),' dive-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo '# Start the docker image' + @echo $(foreach dir,$(DOCKERFILE_DIRS),' start-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo '# Stop the docker image' + @echo $(foreach dir,$(DOCKERFILE_DIRS),' stop-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo '# psql exec the docker image' + @echo $(foreach dir,$(DOCKERFILE_DIRS),' psql-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo '# clean docker image and volume' + @echo $(foreach dir,$(DOCKERFILE_DIRS),' clean-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') + @echo ' ' + @echo 'all : Local run: "update" "build" "test" (without push)' + @echo 'check_version: Check the architecture and version id' + @echo 'check-gh-rate: Check the github ratelimit' + @echo 'dockerlist : List the docker images' + @echo 'help : This help file' + @echo 'imageclean : Remove all local images with the name localhost:5000/ and librarytest' + @echo 'imageclean_${REPO_NAME}_${IMAGE_NAME} : Remove all local images with the name ${REPO_NAME}/${IMAGE_NAME}' + @echo 'lint : Run shellcheck on all .sh files' + @echo 'push-readme : Push README.md to Dockerhub' + @echo 'shfmt : Format the shell scripts' + @echo 'test-prepare : Clone official-images repository' + @echo 'update : Generate/Update all Dockerfiles' + @echo '------------------------------------ ' + @echo 'You can check the the command without executing: make -n ' + @echo ' ' -.PHONY: build all update test-prepare test tag-latest push push-latest \ - $(foreach version,$(VERSIONS),build-$(version)) \ - $(foreach version,$(VERSIONS),test-$(version)) \ - $(foreach version,$(VERSIONS),push-$(version)) +.PHONY: help build all update test-prepare test push push-readme manifest \ + check-gh-rate check_version dockerlist lint imageclean imageclean_${REPO_NAME}_${IMAGE_NAME} \ + $(foreach version,$(VERSIONS),' build-$(version)') \ + $(foreach dir,$(DOCKERFILE_DIRS),' build-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach version,$(VERSIONS),' test-$(version)') \ + $(foreach dir,$(DOCKERFILE_DIRS),' test-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach version,$(VERSIONS),' push-$(version)') \ + $(foreach dir,$(DOCKERFILE_DIRS),' push-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach version,$(VERSIONS),' manifest-$(version)') \ + $(foreach dir,$(DOCKERFILE_DIRS),' manifest-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach dir,$(DOCKERFILE_DIRS),' scan-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach dir,$(DOCKERFILE_DIRS),' dive-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach dir,$(DOCKERFILE_DIRS),' start-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach dir,$(DOCKERFILE_DIRS),' stop-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach dir,$(DOCKERFILE_DIRS),' psql-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') \ + $(foreach dir,$(DOCKERFILE_DIRS),' clean-$(word 1,$(subst /, ,$(dir)))-$(word 2,$(subst /, ,$(dir)))') diff --git a/README.md b/README.md index 7877bc98..78a19751 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ -# postgis/postgis +# 🚧🔧💡🧹 WIP: Experimental development: -[![Build Status](https://github.com/postgis/docker-postgis/workflows/Docker%20PostGIS%20CI/badge.svg)](https://github.com/postgis/docker-postgis/actions) [![Join the chat at https://gitter.im/postgis/docker-postgis](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/postgis/docker-postgis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +* 🧪🐳 test images (amd64 + arm64) for the users: https://hub.docker.com/r/imresamu/postgis + * 🧪 internal amd64 only repo: https://hub.docker.com/r/imresamu/postgis-amd64/tags + * 🧪 internal arm64 only repo: https://hub.docker.com/r/imresamu/postgis-arm64/tags +* 🧪 code: https://github.com/ImreSamu/docker-postgis +* Status: Experimental, under active development -The `postgis/postgis` image provides tags for running Postgres with [PostGIS](http://postgis.net/) extensions installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides debian and alpine variants for PostGIS 3.4.x, which is compatible with PostgreSQL versions 12, 13, 14, 15, and 16. For PostgreSQL version 11, the image supports PostGIS 3.3, as it is not compatible with PostGIS 3.4. Additionally, an image version is provided which is built from the latest two versions of Postgres (15, 16) with versions of PostGIS and its dependencies built from their respective master branches. +------------------------ +# 🐳🐘🌍 postgis/postgis +[![Build Status](https://github.com/imresamu/docker-postgis/workflows/Build%20PostGIS%20images/badge.svg)](https://github.com/imresamu/docker-postgis/actions) [![Join the chat at https://gitter.im/postgis/docker-postgis](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/postgis/docker-postgis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +**Important:** _Please note that this README document is larger than the 25,000 character limit set by Docker Hub. As a result, the version available on Docker Hub will be trimmed and not complete._ +_For the complete and untrimmed version of the README, it is recommended to visit the project GitHub page:_ https://github.com/ImreSamu/docker-postgis/blob/master/README.md + +The `imresamu/postgis` image provides tags for running Postgres with [PostGIS](http://postgis.net/) extensions installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides debian and alpine variants for PostGIS which is compatible with PostgreSQL versions 12, 13, 14, 15, 16 and 17. Additionally, an image version is provided which is built from the latest two versions of Postgres (16,17) with versions of PostGIS and its dependencies built from their respective master branches. This image ensures that the default database created by the parent `postgres` image will have the following extensions installed: -| installed extensions | [initialized](https://github.com/postgis/docker-postgis/blob/master/initdb-postgis.sh)| +| installed extensions | [initialized](https://github.com/imresamu/docker-postgis/blob/master/initdb-postgis.sh)| |---------------------|-----| | `postgis` | yes | | `postgis_topology` | yes | @@ -18,64 +29,181 @@ This image ensures that the default database created by the parent `postgres` im Unless `-e POSTGRES_DB` is passed to the container at startup time, this database will be named after the admin user (either `postgres` or the user specified with `-e POSTGRES_USER`). If you would prefer to use the older template database mechanism for enabling PostGIS, the image also provides a PostGIS-enabled template database called `template_postgis`. -# Versions (2023-09-16) - -Supported architecture: `amd64` (also known as X86-64)" -Recommended version for new users: `postgis/postgis:16-3.4` +## Versions (2024-11-07) -### Debian based (recommended) -* This Docker-PostGIS version has a cautious release cycle to guarantee high stability. - * By "cautious", we mean it does not always have the latest versions of geos, proj, gdal, and sfcgal packages. -* We use PostGIS, geos, proj, gdal, and sfcgal packages from the Debian repository. - * In the Debian Bullseye repository, the versions are: geos=3.9, gdal=3.2, proj=7.2, and sfcgal=1.3.9. -* This version is easy to extend and has matured over time. -* PostgreSQL 11 is not compatible with PostGIS 3.4, so it remains on PostGIS 3.3. Please note that after November 9, 2023, PostgreSQL 11 will reach its [end-of-life (EOL)](https://www.postgresql.org/support/versioning/) and will no longer receive support. +We provide multi-platform image support for the following architectures: +- `amd64`: Also known as x86-64. + - Use `--platform=linux/amd64` when specifying the platform. +- `arm64`: Also known as AArch64. + - Use `--platform=linux/arm64` when specifying the platform. -| DockerHub image | Dockerfile | OS | Postgres | PostGIS | -| --------------- | ---------- | -- | -------- | ------- | -| [postgis/postgis:11-3.3](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=11-3.3) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/11-3.3/Dockerfile) | debian:bullseye | 11 | 3.3.4 | -| [postgis/postgis:12-3.4](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=12-3.4) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/12-3.4/Dockerfile) | debian:bullseye | 12 | 3.4.0 | -| [postgis/postgis:13-3.4](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=13-3.4) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/13-3.4/Dockerfile) | debian:bullseye | 13 | 3.4.0 | -| [postgis/postgis:14-3.4](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-3.4) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-3.4/Dockerfile) | debian:bullseye | 14 | 3.4.0 | -| [postgis/postgis:15-3.4](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-3.4) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-3.4/Dockerfile) | debian:bullseye | 15 | 3.4.0 | -| [postgis/postgis:16-3.4](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=16-3.4) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/16-3.4/Dockerfile) | debian:bullseye | 16 | 3.4.0 | +Notes: -### Alpine based +- The `arm64` architecture support is still experimental. Please refer to the 'arch' column in the version information to determine whether an `arm64` version is available for a specific release. +- We currently do not support 32-bit architectures. Our images are only available for 64-bit architectures. -* The base operating system is [Alpine Linux](https://alpinelinux.org/). It is designed to be small, simple, and secure, and it's based on [musl libc](https://musl.libc.org/). -* In the Alpine 3.18 version, the package versions are: geos=3.11, gdal=3.6, proj=9.2, and sfcgal=1.4. -* PostGIS is compiled from source, making it a bit more challenging to extend. -* PostgreSQL 11 is not compatible with PostGIS 3.4, so it remains on PostGIS 3.3. Please note that after November 9, 2023, PostgreSQL 11 will reach its [end-of-life (EOL)](https://www.postgresql.org/support/versioning/) and will no longer receive support. +## Build Status +| Arch | Build system | Status| +| ---- | :-: | :-: | +| Amd64| [GithubCI-logs](https://github.com/ImreSamu/docker-postgis/actions/workflows/main.yml) | [![Build PostGIS images](https://github.com/ImreSamu/docker-postgis/actions/workflows/main.yml/badge.svg)](https://github.com/ImreSamu/docker-postgis/actions/workflows/main.yml) | +| Arm64 | [CircleCI-logs](https://app.circleci.com/pipelines/github/ImreSamu/docker-postgis) | [![CircleCI](https://dl.circleci.com/status-badge/img/gh/ImreSamu/docker-postgis/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/ImreSamu/docker-postgis/tree/master) | -| DockerHub image | Dockerfile | OS | Postgres | PostGIS | -| --------------- | ---------- | -- | -------- | ------- | -| [postgis/postgis:11-3.3-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=11-3.3-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/11-3.3/alpine/Dockerfile) | alpine:3.18 | 11 | 3.3.4 | -| [postgis/postgis:12-3.4-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=12-3.4-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/12-3.4/alpine/Dockerfile) | alpine:3.18 | 12 | 3.4.0 | -| [postgis/postgis:13-3.4-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=13-3.4-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/13-3.4/alpine/Dockerfile) | alpine:3.18 | 13 | 3.4.0 | -| [postgis/postgis:14-3.4-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-3.4-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-3.4/alpine/Dockerfile) | alpine:3.18 | 14 | 3.4.0 | -| [postgis/postgis:15-3.4-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-3.4-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-3.4/alpine/Dockerfile) | alpine:3.18 | 15 | 3.4.0 | -| [postgis/postgis:16-3.4-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=16-3.4-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/16-3.4/alpine/Dockerfile) | alpine:3.18 | 16 | 3.4.0 | +### 🌟Recommended Versions for New Users -### Test images +For those new to PostGIS, we recommend the following image versions: -* We provide alpha, beta, release candidate (rc), and development (identified as ~master) versions. -* The template for the `*-master` images is updated manually, which might lead to a delay of a few weeks sometimes. -* The ~master SFCGAL version is 1.4 or higher. The cgal version is locked on the [5.6.x-branch](https://github.com/CGAL/cgal/tree/5.6.x-branch). +- `imresamu/postgis:17-3.5-bookworm`: This image includes a minimal setup of PostgreSQL with the PostGIS extension. ( debian bookworm based, easy to extend with debian packages ) +- `imresamu/postgis:17-recent-bookworm`: (experimental) Latest postgis with the latest geos,proj,gdal,sfcgal. ( debian based, extending is complex ! ) +- `imresamu/postgis:16-3.4-bundle0-bookworm`: (experimental) This image includes additional geospatial-related extras along with PostgreSQL and PostGIS. -| DockerHub image | Dockerfile | OS | Postgres | PostGIS | -| --------------- | ---------- | -- | -------- | ------- | -| [postgis/postgis:15-master](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-master) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-master/Dockerfile) | debian:bullseye | 15 | development: postgis, geos, proj, gdal | -| [postgis/postgis:16-master](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=16-master) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/16-master/Dockerfile) | debian:bullseye | 16 | development: postgis, geos, proj, gdal | +### 🥇Debian - bookworm (recommended) -## Usage +- This Docker-PostGIS version has a cautious release cycle to guarantee high stability. + - By "cautious", we mean it does not always have the latest versions of geos, proj, gdal, and sfcgal packages. +- We use PostGIS, geos, proj, gdal, and sfcgal packages from the Debian repository. + - In the Debian Bullseye repository, the versions are: geos=3.11, gdal=3.6, proj=9.1, and sfcgal=1.4. +- This version is easy to extend and has matured over time. + + +| `docker.io/imresamu/postgis:` tags | Dockerfile | Arch | OS | Postgres | PostGIS | +| ---- | :-: | :-: | :-: | :-: | :-: | +| [`12-3.5-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5-bookworm), [`12-3.5.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5.0-bookworm), [`12-3.5`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/12-3.5/bookworm/Dockerfile) | amd64 arm64 | bookworm | 12 | 3.5.0 | +| [`13-3.5-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5-bookworm), [`13-3.5.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5.0-bookworm), [`13-3.5`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/13-3.5/bookworm/Dockerfile) | amd64 arm64 | bookworm | 13 | 3.5.0 | +| [`14-3.5-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5-bookworm), [`14-3.5.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5.0-bookworm), [`14-3.5`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/14-3.5/bookworm/Dockerfile) | amd64 arm64 | bookworm | 14 | 3.5.0 | +| [`15-3.5-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5-bookworm), [`15-3.5.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5.0-bookworm), [`15-3.5`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/15-3.5/bookworm/Dockerfile) | amd64 arm64 | bookworm | 15 | 3.5.0 | +| [`16-3.5-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5-bookworm), [`16-3.5.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5.0-bookworm), [`16-3.5`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-3.5/bookworm/Dockerfile) | amd64 arm64 | bookworm | 16 | 3.5.0 | +| [`17-3.5-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5-bookworm), [`17-3.5.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5.0-bookworm), [`17-3.5`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5), [`latest`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=latest) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/17-3.5/bookworm/Dockerfile) | amd64 arm64 | bookworm | 17 | 3.5.0 | + + +### 📘Debian - bullseye + +- We use PostGIS, geos, proj, gdal, and sfcgal packages from the Debian repository. + - In the Debian Bullseye repository, the versions are: geos=3.9, gdal=3.2, proj=7.2, and sfcgal=1.3.9. +- This version is easy to extend and has matured over time. + + +| `docker.io/imresamu/postgis:` tags | Dockerfile | Arch | OS | Postgres | PostGIS | +| ---- | :-: | :-: | :-: | :-: | :-: | +| [`12-3.5-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5-bullseye), [`12-3.5.0-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5.0-bullseye) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/12-3.5/bullseye/Dockerfile) | amd64 arm64 | bullseye | 12 | 3.5.0 | +| [`13-3.5-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5-bullseye), [`13-3.5.0-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5.0-bullseye) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/13-3.5/bullseye/Dockerfile) | amd64 arm64 | bullseye | 13 | 3.5.0 | +| [`14-3.5-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5-bullseye), [`14-3.5.0-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5.0-bullseye) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/14-3.5/bullseye/Dockerfile) | amd64 arm64 | bullseye | 14 | 3.5.0 | +| [`15-3.5-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5-bullseye), [`15-3.5.0-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5.0-bullseye) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/15-3.5/bullseye/Dockerfile) | amd64 arm64 | bullseye | 15 | 3.5.0 | +| [`16-3.5-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5-bullseye), [`16-3.5.0-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5.0-bullseye) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-3.5/bullseye/Dockerfile) | amd64 arm64 | bullseye | 16 | 3.5.0 | +| [`17-3.5-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5-bullseye), [`17-3.5.0-bullseye`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5.0-bullseye) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/17-3.5/bullseye/Dockerfile) | amd64 arm64 | bullseye | 17 | 3.5.0 | + + + +### 🧪Recent ( experimental ) + +* These images are similar to the debian-based `*-master` images ( same Dockerfile template ) However, for every build, we use the latest released tag from each library (such as postgis, geos, proj, gdal, cgal, sfcgal). +* These images are ideal for testing purposes, but expanding them is not straightforward. +* The specific versions of the libraries used (like postgis, geos, proj, gdal, cgal, sfcgal) can be found in the tags of the image or in the Dockerfile. + + +| `docker.io/imresamu/postgis:` tags | Dockerfile | Arch | OS | Postgres | PostGIS | +| ---- | :-: | :-: | :-: | :-: | :-: | +| [`16-recent-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-recent-bookworm), [`16-recent-postgis3.5.0-geos3.13.0-proj9.5.0-gdal3.10.0-cgal6.0.1-sfcgal2.0.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-recent-postgis3.5.0-geos3.13.0-proj9.5.0-gdal3.10.0-cgal6.0.1-sfcgal2.0.0-bookworm), [`16-recent-postgis3.5-geos3.13-proj9.5-gdal3.10-cgal6.0-sfcgal2.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-recent-postgis3.5-geos3.13-proj9.5-gdal3.10-cgal6.0-sfcgal2.0-bookworm), [`16-recent`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-recent) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-recent/bookworm/Dockerfile) | amd64 arm64 | bookworm | 16 | postgis=tags/3.5.0, geos=tags/3.13.0, proj=tags/9.5.0, gdal=tags/v3.10.0, cgal=tags/v6.0.1, sfcgal=tags/v2.0.0 | +| [`17-recent-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-recent-bookworm), [`17-recent-postgis3.5.0-geos3.13.0-proj9.5.0-gdal3.10.0-cgal6.0.1-sfcgal2.0.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-recent-postgis3.5.0-geos3.13.0-proj9.5.0-gdal3.10.0-cgal6.0.1-sfcgal2.0.0-bookworm), [`17-recent-postgis3.5-geos3.13-proj9.5-gdal3.10-cgal6.0-sfcgal2.0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-recent-postgis3.5-geos3.13-proj9.5-gdal3.10-cgal6.0-sfcgal2.0-bookworm), [`17-recent`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-recent), [`recent`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=recent) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/17-recent/bookworm/Dockerfile) | amd64 arm64 | bookworm | 17 | postgis=tags/3.5.0, geos=tags/3.13.0, proj=tags/9.5.0, gdal=tags/v3.10.0, cgal=tags/v6.0.1, sfcgal=tags/v2.0.0 | + + +### 🧪Debian Geo Bundle ( experimental ) + +This repository provides Debian-based PostGIS Docker images enriched with additional geospatial packages such as [pgRouting](https://pgrouting.org/), [h3-pg]( https://github.com/zachasme/h3-pg), [pgsql-ogr-fdw](https://github.com/pramsey/pgsql-ogr-fdw), [MobilityDB](https://mobilitydb.com/), [PL/Python3](https://www.postgresql.org/docs/current/plpython.html), [pgPointcloud](https://pgpointcloud.github.io/pointcloud/), [pgVector](https://github.com/pgvector/pgvector), [TimeScaleDB](https://www.timescale.com/) and others. +These images serve as a comprehensive solution for various server side geospatial needs. +Please note that the included package list is subject to change as we continue to refine the 'bundle0'. + + + +| `docker.io/imresamu/postgis:` tags | Dockerfile | Arch | OS | Postgres | PostGIS | +| ---- | :-: | :-: | :-: | :-: | :-: | +| [`16-3.5-bundle0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5-bundle0-bookworm), [`16-3.5.0-bundle0-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5.0-bundle0-bookworm), [`16-3.5-bundle0`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5-bundle0) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-3.5-bundle0/bookworm/Dockerfile) | amd64 arm64 | bookworm | 16 | 3.5.0 | + + + +### ⛰️Alpine 3.19 based + +- The base operating system is [Alpine Linux](https://alpinelinux.org/). It is designed to be small, simple, and secure, and it's based on [musl libc](https://musl.libc.org/). +- In the Alpine 3.19 version, the package versions are: geos=3.12.1, gdal=3.8.1, proj=9.3.1, and sfcgal=1.5.0 +- PostGIS is compiled from source, making it a bit more challenging to extend. + + +| `docker.io/imresamu/postgis:` tags | Dockerfile | Arch | OS | Postgres | PostGIS | +| ---- | :-: | :-: | :-: | :-: | :-: | +| [`12-3.4-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.4-alpine3.19), [`12-3.4.3-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.4.3-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/12-3.4/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 12 | 3.4.3 | +| [`12-3.5-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5-alpine3.19), [`12-3.5.0-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5.0-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/12-3.5/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 12 | 3.5.0 | +| [`13-3.4-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.4-alpine3.19), [`13-3.4.3-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.4.3-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/13-3.4/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 13 | 3.4.3 | +| [`13-3.5-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5-alpine3.19), [`13-3.5.0-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5.0-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/13-3.5/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 13 | 3.5.0 | +| [`14-3.4-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.4-alpine3.19), [`14-3.4.3-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.4.3-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/14-3.4/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 14 | 3.4.3 | +| [`14-3.5-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5-alpine3.19), [`14-3.5.0-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5.0-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/14-3.5/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 14 | 3.5.0 | +| [`15-3.4-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.4-alpine3.19), [`15-3.4.3-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.4.3-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/15-3.4/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 15 | 3.4.3 | +| [`15-3.5-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5-alpine3.19), [`15-3.5.0-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5.0-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/15-3.5/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 15 | 3.5.0 | +| [`16-3.4-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.4-alpine3.19), [`16-3.4.3-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.4.3-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-3.4/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 16 | 3.4.3 | +| [`16-3.5-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5-alpine3.19), [`16-3.5.0-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5.0-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-3.5/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 16 | 3.5.0 | +| [`17-3.5-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5-alpine3.19), [`17-3.5.0-alpine3.19`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5.0-alpine3.19) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/17-3.5/alpine3.19/Dockerfile) | amd64 arm64 | alpine3.19 | 17 | 3.5.0 | + + +### ⛰️Alpine 3.20 based + +- The base operating system is [Alpine Linux](https://alpinelinux.org/). It is designed to be small, simple, and secure, and it's based on [musl libc](https://musl.libc.org/). +- In the Alpine 3.20 version, the package versions are: geos=3.12.1, gdal=3.9.0, proj=9.4.0, and sfcgal=1.5.1 +- PostGIS is compiled from source, making it a bit more challenging to extend. + + +| `docker.io/imresamu/postgis:` tags | Dockerfile | Arch | OS | Postgres | PostGIS | +| ---- | :-: | :-: | :-: | :-: | :-: | +| [`12-3.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.3-alpine3.20), [`12-3.3.7-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.3.7-alpine3.20), [`12-3.3-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.3-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/12-3.3/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 12 | 3.3.7 | +| [`12-3.4-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.4-alpine3.20), [`12-3.4.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.4.3-alpine3.20), [`12-3.4-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.4-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/12-3.4/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 12 | 3.4.3 | +| [`12-3.5-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5-alpine3.20), [`12-3.5.0-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5.0-alpine3.20), [`12-3.5-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=12-3.5-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/12-3.5/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 12 | 3.5.0 | +| [`13-3.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.3-alpine3.20), [`13-3.3.7-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.3.7-alpine3.20), [`13-3.3-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.3-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/13-3.3/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 13 | 3.3.7 | +| [`13-3.4-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.4-alpine3.20), [`13-3.4.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.4.3-alpine3.20), [`13-3.4-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.4-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/13-3.4/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 13 | 3.4.3 | +| [`13-3.5-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5-alpine3.20), [`13-3.5.0-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5.0-alpine3.20), [`13-3.5-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=13-3.5-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/13-3.5/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 13 | 3.5.0 | +| [`14-3.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.3-alpine3.20), [`14-3.3.7-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.3.7-alpine3.20), [`14-3.3-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.3-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/14-3.3/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 14 | 3.3.7 | +| [`14-3.4-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.4-alpine3.20), [`14-3.4.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.4.3-alpine3.20), [`14-3.4-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.4-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/14-3.4/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 14 | 3.4.3 | +| [`14-3.5-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5-alpine3.20), [`14-3.5.0-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5.0-alpine3.20), [`14-3.5-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-3.5-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/14-3.5/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 14 | 3.5.0 | +| [`15-3.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.3-alpine3.20), [`15-3.3.7-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.3.7-alpine3.20), [`15-3.3-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.3-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/15-3.3/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 15 | 3.3.7 | +| [`15-3.4-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.4-alpine3.20), [`15-3.4.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.4.3-alpine3.20), [`15-3.4-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.4-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/15-3.4/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 15 | 3.4.3 | +| [`15-3.5-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5-alpine3.20), [`15-3.5.0-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5.0-alpine3.20), [`15-3.5-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=15-3.5-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/15-3.5/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 15 | 3.5.0 | +| [`16-3.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.3-alpine3.20), [`16-3.3.7-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.3.7-alpine3.20), [`16-3.3-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.3-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-3.3/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 16 | 3.3.7 | +| [`16-3.4-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.4-alpine3.20), [`16-3.4.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.4.3-alpine3.20), [`16-3.4-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.4-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-3.4/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 16 | 3.4.3 | +| [`16-3.5-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5-alpine3.20), [`16-3.5.0-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5.0-alpine3.20), [`16-3.5-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-3.5-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-3.5/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 16 | 3.5.0 | +| [`17-3.4-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.4-alpine3.20), [`17-3.4.3-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.4.3-alpine3.20), [`17-3.4-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.4-alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/17-3.4/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 17 | 3.4.3 | +| [`17-3.5-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5-alpine3.20), [`17-3.5.0-alpine3.20`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5.0-alpine3.20), [`17-3.5-alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-3.5-alpine), [`alpine`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=alpine) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/17-3.5/alpine3.20/Dockerfile) | amd64 arm64 | alpine3.20 | 17 | 3.5.0 | + + + +### 🧪Locked ( experimental ) + +* Locked old postgis versions for testing. +* Definition in the [./locked.yml](locked.yml) + * and the image identifiers : -l + +| `docker.io/imresamu/postgis:` tags | Dockerfile | Arch | OS | Postgres | PostGIS | +| ---- | :-: | :-: | :-: | :-: | :-: | +| [`14-l3.1.9gcp-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-l3.1.9gcp-bookworm), [`14-l3.1.9gcp-postgis3.1.9-geos3.6.6-proj6.3.1-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=14-l3.1.9gcp-postgis3.1.9-geos3.6.6-proj6.3.1-bookworm) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/14-l3.1.9gcp/bookworm/Dockerfile) | amd64 arm64 | bookworm | 14 | postgis=tags/3.1.9, geos=tags/3.6.6, proj=tags/6.3.1, gdal=tags/v3.6.4, cgal=tags/v5.6, sfcgal=tags/v1.5.1 | + + +### 📋Test images + +- We provide alpha, beta, release candidate (rc), and development (identified as ~master) versions. +- The template for the `*-master` images is updated manually, which might lead to a delay of a few weeks sometimes. +- The ~master SFCGAL version is 1.5 or higher. The cgal version is locked on the [5.6.x-branch](https://github.com/CGAL/cgal/tree/5.6.x-branch). + + +| `docker.io/imresamu/postgis:` tags | Dockerfile | Arch | OS | Postgres | PostGIS | +| ---- | :-: | :-: | :-: | :-: | :-: | +| [`16-master-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-master-bookworm), [`16-master`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=16-master) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/16-master/bookworm/Dockerfile) | amd64 arm64 | bookworm | 16 | development: postgis, geos, proj, gdal, cgal, sfcgal | +| [`17-master-bookworm`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-master-bookworm), [`17-master`](https://registry.hub.docker.com/r/imresamu/postgis/tags?page=1&name=17-master) | [Dockerfile](https://github.com/imresamu/docker-postgis/blob/master/17-master/bookworm/Dockerfile) | amd64 arm64 | bookworm | 17 | development: postgis, geos, proj, gdal, cgal, sfcgal | + + +## 🚀Usage In order to run a basic container capable of serving a PostGIS-enabled database, start a container as follows: - docker run --name some-postgis -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis + docker run --name some-postgis -e POSTGRES_PASSWORD=mysecretpassword -d imresamu/postgis For more detailed instructions about how to start and control your Postgres container, see the documentation for the `postgres` image [here](https://registry.hub.docker.com/_/postgres/). @@ -88,26 +216,26 @@ Once you have started a database container, you can then connect to the database docker network create some-network # Server container - docker run --name some-postgis --network some-network -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis + docker run --name some-postgis --network some-network -e POSTGRES_PASSWORD=mysecretpassword -d imresamu/postgis # Client container - docker run -it --rm --network some-network postgis/postgis psql -h some-postgis -U postgres + docker run -it --rm --network some-network imresamu/postgis psql -h some-postgis -U postgres Check the documentation on the [`postgres` image](https://registry.hub.docker.com/_/postgres/) and [Docker networking](https://docs.docker.com/network/) for more details and alternatives on connecting different containers. See [the PostGIS documentation](http://postgis.net/docs/postgis_installation.html#create_new_db_extensions) for more details on your options for creating and using a spatially-enabled database. -## Supported Environment Variables: +## 🔧Supported Environment Variables: Since the docker-postgis repository is an extension of the official Docker PostgreSQL repository, all environment variables supported there are also supported here: -* `POSTGRES_PASSWORD` -* `POSTGRES_USER` -* `POSTGRES_DB` -* `POSTGRES_INITDB_ARGS` -* `POSTGRES_INITDB_WALDIR` -* `POSTGRES_HOST_AUTH_METHOD` -* `PGDATA` +- `POSTGRES_PASSWORD` +- `POSTGRES_USER` +- `POSTGRES_DB` +- `POSTGRES_INITDB_ARGS` +- `POSTGRES_INITDB_WALDIR` +- `POSTGRES_HOST_AUTH_METHOD` +- `PGDATA` Read more: https://github.com/docker-library/docs/blob/master/postgres/README.md @@ -116,37 +244,62 @@ Warning: **the Docker specific variables will only have an effect if you start t It's important to note that the environment variables for the Docker image are different from those of the [libpq — C Library](https://www.postgresql.org/docs/current/libpq-envars.html) (`PGDATABASE`,`PGUSER`,`PGPASSWORD` ) -## Troubleshooting tips: +## ⚠️ Troubleshooting tips: Troubleshooting can often be challenging. It's important to know that the docker-postgis repository is an extension of the official Docker PostgreSQL repository. Therefore, if you encounter any issues, it's worth testing whether the problem can be reproduced with the [official PostgreSQL Docker images](https://hub.docker.com/_/postgres). If so, it's recommended to search for solutions based on this. The following websites are suggested: -* Upstream docker postgres repo: https://github.com/docker-library/postgres - * search for the open or closed issues ! -* Docker Community Forums: https://forums.docker.com -* Docker Community Slack: https://dockr.ly/slack -* Stack Overflow: https://stackoverflow.com/questions/tagged/docker+postgresql +- Upstream docker postgres repo: https://github.com/docker-library/postgres + - search for the open or closed issues ! +- Docker Community Forums: https://forums.docker.com +- Docker Community Slack: https://dockr.ly/slack +- Stack Overflow: https://stackoverflow.com/questions/tagged/docker+postgresql If your problem is Postgis related: -* Stack Overflow : docker + postgis https://stackoverflow.com/questions/tagged/docker+postgis -* Postgis issue tracker: https://trac.osgeo.org/postgis/report +- Stack Overflow : docker + postgis https://stackoverflow.com/questions/tagged/docker+postgis +- Postgis issue tracker: https://trac.osgeo.org/postgis/report And if you don't have a postgres docker experience - read this blog post: -* https://www.docker.com/blog/how-to-use-the-postgres-docker-official-image/ +- https://www.docker.com/blog/how-to-use-the-postgres-docker-official-image/ -## Security +## 🔒Security It's crucial to be aware that in a cloud environment, with default settings, these images are vulnerable, and there's a high risk of cryptominer infection if the ports are left open. ( [Read More](https://github.com/docker-library/postgres/issues/770#issuecomment-704460980) ) -* Note that ports which are not bound to the host (i.e., `-p 5432:5432` instead of `-p 127.0.0.1:5432:5432`) will be accessible from the outside. This also applies if you configured UFW to block this specific port, as Docker manages its own iptables rules. ( [Read More](https://docs.docker.com/network/iptables/) ) -Recomendations: -* You can add options for using SSL ( [see postgres example](https://github.com/docker-library/postgres/issues/989#issuecomment-1222648067) ) +- Note that ports which are not bound to the host (i.e., `-p 5432:5432` instead of `-p 127.0.0.1:5432:5432`) will be accessible from the outside. This also applies if you configured UFW to block this specific port, as Docker manages its own iptables rules. ( [Read More](https://docs.docker.com/network/iptables/) ) + +#### Recomendations: + +- You can add options for using SSL ( [see postgres example](https://github.com/docker-library/postgres/issues/989#issuecomment-1222648067) ) - `-c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key` -* Or you can use [SSH Tunnels](https://www.postgresql.org/docs/15/ssh-tunnels.html) with `-p 127.0.0.1:5432:5432` +- Or you can use [SSH Tunnels](https://www.postgresql.org/docs/15/ssh-tunnels.html) with `-p 127.0.0.1:5432:5432` + +#### Security scanner information: -## Known Issues / Errors +- Scan the base `postgres` docker Image: +It's important to also scan the base `postgres` Docker image for potential security issues. If your security scanner reports vulnerabilities (known as CVEs) in the image, you may wonder why. To get a better understanding, please read the Docker Library FAQ, especially the section titled ["Why does my security scanner show that an image has CVEs?"](https://github.com/docker-library/faq#why-does-my-security-scanner-show-that-an-image-has-cves) +For more specific issues related to the postgres docker image, you can search using these links: + - [search for repo:docker-library/postgres trivy](https://github.com/search?q=repo%3Adocker-library%2Fpostgres+trivy&type=issues) + - [search for repo:docker-library/postgres CVE](https://github.com/search?q=repo%3Adocker-library%2Fpostgres+CVE&type=issues) + +- Optimizing Security Scans: +It's advisable to focus on scanning and fixing issues that can be resolved. +Use this command to scan for fixable issues only: + * `trivy image --ignore-unfixed postgis/postgis:16-3.4-alpine` + * `trivy image --ignore-unfixed postgres:16-alpine` +For more details, you can read this article: https://pythonspeed.com/articles/docker-security-scanner/ + +#### Limitations on Updates: +Unfortunately, we don't have control over updates to Debian and Alpine distributions or the upstream `postgres` image. +Because of this, there might be some issues that we cannot fix right away. +On the positive side, the `postgis/postgis` images are regenerated every Monday. This process is to ensure they include the latest changes and improvements. As a result, these images are consistently kept up-to-date. + +#### Suggestions Welcome: +We are always open to suggestions to enhance security. If you have any ideas, please let us know. + +## ❗Known Issues / Errors When You encouter errors due to PostGIS update `OperationalError: could not access file "$libdir/postgis-X.X`, run: @@ -166,4 +319,3 @@ NOTICE: version "X.X.X" of extension "postgis_topology" is already installed NOTICE: version "X.X.X" of extension "postgis_tiger_geocoder" is already installed ALTER EXTENSION ``` - diff --git a/_migrate.sh b/_migrate.sh new file mode 100755 index 00000000..2857e15a --- /dev/null +++ b/_migrate.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +# temporary files, only for the migration. +# will be removed... + +debian_move() { + mkdir -p "$1/bullseye" + mkdir -p "$1/bookworm" + + git mv "$1/Dockerfile" "$1/bullseye/Dockerfile" + git mv "$1/initdb-postgis.sh" "$1/bullseye/initdb-postgis.sh" + git mv "$1/update-postgis.sh" "$1/bullseye/update-postgis.sh" + + cp "$1/bullseye/Dockerfile" "$1/bookworm/Dockerfile" + cp "$1/bullseye/initdb-postgis.sh" "$1/bookworm/initdb-postgis.sh" + cp "$1/bullseye/update-postgis.sh" "$1/bookworm/update-postgis.sh" + + git add "$1/bookworm/Dockerfile" + git add "$1/bookworm/initdb-postgis.sh" + git add "$1/bookworm/update-postgis.sh" +} + +bookworm_move() { + mkdir -p "$1/bookworm" + git mv "$1/Dockerfile" "$1/bookworm/Dockerfile" + git mv "$1/initdb-postgis.sh" "$1/bookworm/initdb-postgis.sh" + git mv "$1/update-postgis.sh" "$1/bookworm/update-postgis.sh" +} + +alpine_move() { + git mv "$1/alpine" "$1/alpine3.18" +} + +debian_move 11-3.3 +debian_move 12-3.4 +debian_move 13-3.4 +debian_move 14-3.4 +debian_move 15-3.4 +debian_move 16beta3-3.4 + +bookworm_move 14-master +bookworm_move 15-master +bookworm_move 16beta3-master + +alpine_move 11-3.3 +alpine_move 12-3.4 +alpine_move 13-3.4 +alpine_move 14-3.4 +alpine_move 15-3.4 +alpine_move 16beta3-3.4 + +git mv 16beta3-3.4 16-3.4 +git mv 16beta3-master 16-master + +git mv Dockerfile.template Dockerfile.debian.template + +mkdir -p 12-3.4-bundle +mkdir -p 13-3.4-bundle +mkdir -p 14-3.4-bundle +mkdir -p 15-3.4-bundle + +mkdir -p 12-3.4-bundle/bookworm +mkdir -p 13-3.4-bundle/bookworm +mkdir -p 14-3.4-bundle/bookworm +mkdir -p 15-3.4-bundle/bookworm + +touch 12-3.4-bundle/bookworm/Dockerfile +touch 13-3.4-bundle/bookworm/Dockerfile +touch 14-3.4-bundle/bookworm/Dockerfile +touch 15-3.4-bundle/bookworm/Dockerfile diff --git a/apply-ci.sh b/apply-ci.sh new file mode 100755 index 00000000..cf3ba390 --- /dev/null +++ b/apply-ci.sh @@ -0,0 +1,93 @@ +#!/bin/bash +set -Eeuo pipefail +# Source environment variables and necessary configurations +source tools/environment_init.sh + +[ -f ./versions.json ] +input_file="versions.json" + +# cleaning the workfile +rm -f _matrix.yml +rm -f _circleci_arm64.yml + +## Load .env files config. +#set -a +#if [[ "${TEST:-}" == "true" ]]; then +# # shellcheck disable=SC1091 +# source .env.test +#else +# # shellcheck disable=SC1091 +# source .env +#fi +#set +a + +versions=$(jq 'keys[]' "$input_file") + +# the bundle version and the source - should be generated in the same workflow. +# so we need all bundle base list - for removing the matrix. +function generate_versions_bundle_base() { + versions_bundle_base='' + for version in $versions; do + version=$(echo "$version" | tr -d '"') + variants=$(jq ".\"$version\" | keys[]" "$input_file") + for variant in $variants; do + variant=$(echo "$variant" | tr -d '"') + if [[ $(echo "$version" | grep -o '-' | wc -l) -eq 2 ]]; then + echo "bundle detected: ${version}-${variant} ( The version variable contains two '-' ) " + versions_bundle_base+=$(echo "${version}" | cut -d'-' -f1-2)-${variant} + fi + done + done + echo "## versions_bundle_base=$versions_bundle_base" +} +generate_versions_bundle_base + +#TODO: arch based filter for amd64 and arm64 +for version in $versions; do + # Remove quotes around version + version=$(echo "$version" | tr -d '"') + variants=$(jq ".\"$version\" | keys[]" "$input_file") + for variant in $variants; do + + # Remove quotes around variant + variant=$(echo "$variant" | tr -d '"') + arch=$(jq -r ".\"$version\".\"$variant\".arch" "$input_file") + + if [[ $arch == *"amd64"* ]]; then + if [[ $versions_bundle_base =~ ${version}-${variant} ]]; then + echo "# --skip-- - { version: \"$version\", variant: \"$variant\" } --> generated with the related bundle job!" >>_matrix.yml + else + echo " - { version: \"$version\", variant: \"$variant\" }" >>_matrix.yml + fi + fi + + if [[ $arch == *"arm64"* ]]; then + if [[ $versions_bundle_base =~ ${version}-${variant} ]]; then + echo "# --skip-- \"${version}-${variant}\", --> generated with the related bundle job!" >>_circleci_arm64.yml + else + echo " \"${version}-${variant}\"," >>_circleci_arm64.yml + fi + fi + + done +done + +# ------------- Update .github/workflows/main.yml ------------------ +echo "## update .github/workflows/main.yml ##" +awk -v content="$(<_matrix.yml)" ' +$0 ~ "#matrix-include-start" {print; print content; f=1; next} +$0 ~ "#matrix-include-end" {f=0} +!f' .github/workflows/main.yml >.github/workflows/main.tmp && mv .github/workflows/main.tmp .github/workflows/main.yml + +echo "## _matrix.yml ## " +cat _matrix.yml + +# ------------- Update .circleci/config.yml ------------------ +echo "## update .circleci/config.yml ##" +awk -v content="$(<_circleci_arm64.yml)" ' +$0 ~ "#circleci-targets-start" {print; print content; f=1; next} +$0 ~ "#circleci-targets-end" {f=0} +!f' .circleci/config.yml >.circleci/config.tmp && mv .circleci/config.tmp .circleci/config.yml + +echo "## _circleci_arm64.yml ##" +cat _circleci_arm64.yml diff --git a/apply-manifest.sh b/apply-manifest.sh new file mode 100755 index 00000000..f2dda947 --- /dev/null +++ b/apply-manifest.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +# Source environment variables and necessary configurations +source tools/environment_init.sh + +[ -f ./versions.json ] +input_file="versions.json" +rm -f manifest.sh + +cat <<'EOF' >manifest.sh +#!/usr/bin/env bash +set -Eeuo pipefail +# Source environment variables and necessary configurations +source tools/environment_init.sh + +# +# Updating the docker manifest for the postgis image. +# This script uses the version.json metadata file as input to create the updated manifest. +# manifest-tool doc : https://github.com/estesp/manifest-tool +# +# NOTE: THIS FILE IS GENERATED VIA "./apply-manifest.sh" +# PLEASE DO NOT EDIT IT DIRECTLY. +# +EOF + +create_manifest() { + local tags="$1" + local arch="$2" + + # Split tags and arch into arrays + IFS=' ' read -ra tag_array <<<"$tags" + IFS=' ' read -ra arch_array <<<"$arch" + + # Check the arch parameter + if [[ ${#arch_array[@]} -lt 1 || ${#arch_array[@]} -gt 2 ]]; then + echo "Error: The arch parameter must have 1 or 2 elements." + return 1 + fi + + local platform_arch="" + for element in "${arch_array[@]}"; do + if [ -z "$platform_arch" ]; then + platform_arch="linux/$element" + else + platform_arch="$platform_arch,linux/$element" + fi + done + + # Create and push manifest for each tag. + # comment: Sometimes some images is missing ( ~ synchronisation issues with CircleCI ) + # .. and we have to continue the script, so we use the || true + for tag in "${tag_array[@]}"; do + echo "" + echo "echo \"manifest: \${dockername}:${tag}\"" + echo "manifest-tool push from-args \\" + echo " --platforms $platform_arch \\" + echo " --template \${dockername}-ARCHVARIANT:${tag} \\" + echo " --target \${dockername}:${tag} || true" + done +} + +versions=$(jq 'keys[]' "$input_file") +for version in $versions; do + # Remove quotes around version + version=$(echo "$version" | tr -d '"') + variants=$(jq ".\"$version\" | keys[]" "$input_file") + for variant in $variants; do + # Remove quotes around variant + variant=$(echo "$variant" | tr -d '"') + tags=$(jq -r ".\"$version\".\"$variant\".tags" "$input_file") + arch=$(jq -r ".\"$version\".\"$variant\".arch" "$input_file") + + ( + echo "" + echo "# ----- ${version}-${variant} -----" + create_manifest "$tags" "$arch" + ) >>manifest.sh + + done +done + +echo "Done! a new ./manifest.sh has been created!" +chmod +x ./manifest.sh +head -n 50 <./manifest.sh diff --git a/apply-readme.sh b/apply-readme.sh new file mode 100755 index 00000000..e7c409f2 --- /dev/null +++ b/apply-readme.sh @@ -0,0 +1,99 @@ +#!/bin/bash +set -Eeuo pipefail +# Source environment variables and necessary configurations +source tools/environment_init.sh + +[ -f ./versions.json ] + +input_file="versions.json" +versions=$(jq 'keys[]' "$input_file") +distinct_variants=$(jq -r 'to_entries[] | .value | keys[]' "$input_file" | sort -u) + +rm -f _dockerlists_*.md +for readme_group in $distinct_variants recent locked bundle0 test; do + echo "init _dockerlists_${readme_group}.md" + echo "| \`$README_IMAGE_NAME:\` tags | Dockerfile | Arch | OS | Postgres | PostGIS |" >>_dockerlists_"${readme_group}".md + echo "| ---- | :-: | :-: | :-: | :-: | :-: |" >>_dockerlists_"${readme_group}".md +done + +for version in $versions; do + # Remove quotes around version + version=$(echo "$version" | tr -d '"') + variants=$(jq ".\"$version\" | keys[]" "$input_file") + for variant in $variants; do + + variant=$(echo "$variant" | tr -d '"') + readme_group=$(jq -r ".\"$version\".\"$variant\".readme_group" "$input_file") + PG_DOCKER=$(jq -r ".\"$version\".\"$variant\".PG_DOCKER" "$input_file") + POSTGIS_VERSION=$(jq -r ".\"$version\".\"$variant\".POSTGIS_VERSION" "$input_file") + postgis=$(jq -r ".\"$version\".\"$variant\".postgis" "$input_file") + arch=$(jq -r ".\"$version\".\"$variant\".arch" "$input_file") + + if [[ "$postgis" == "master" ]]; then + POSTGIS_DOC_VERSION="development: postgis, geos, proj, gdal, cgal, sfcgal" + elif [[ "$postgis" == "recent" || "$readme_group" == "locked" ]]; then + + POSTGIS_TAG=$(jq -r ".\"$version\".\"$variant\".POSTGIS_CHECKOUT" "$input_file") + PROJ_TAG=$(jq -r ".\"$version\".\"$variant\".PROJ_CHECKOUT" "$input_file") + GDAL_TAG=$(jq -r ".\"$version\".\"$variant\".GDAL_CHECKOUT" "$input_file") + GEOS_TAG=$(jq -r ".\"$version\".\"$variant\".GEOS_CHECKOUT" "$input_file") + CGAL_TAG=$(jq -r ".\"$version\".\"$variant\".CGAL_CHECKOUT" "$input_file") + SFCGAL_TAG=$(jq -r ".\"$version\".\"$variant\".SFCGAL_CHECKOUT" "$input_file") + + POSTGIS_DOC_VERSION="postgis=${POSTGIS_TAG}, geos=${GEOS_TAG}, proj=${PROJ_TAG}, gdal=${GDAL_TAG}, cgal=${CGAL_TAG}, sfcgal=${SFCGAL_TAG}" + else + POSTGIS_DOC_VERSION=$(echo "$POSTGIS_VERSION" | awk -F'[+-]' '{print $1}') + fi + + tags=$(jq -r ".\"$version\".\"$variant\".tags" "$input_file") + tagslinks="" + for tag in $tags; do + tagslinks+="[\`${tag}\`](${dockerhublink}${tag}), " + done + # Remove trailing comma and space + tagslinks=$(echo -n "$tagslinks" | sed 's/, *$//') + + echo "| ${tagslinks} | [Dockerfile](${githubrepolink}/${version}/${variant}/Dockerfile) | ${arch} | ${variant} | ${PG_DOCKER} | ${POSTGIS_DOC_VERSION} |" >>_dockerlists_"${readme_group}".md + + done +done + +echo "|-------------------------|" +echo "|- Generated images -|" +echo "|-------------------------|" + +for readme_group in $distinct_variants recent locked bundle0 test; do + echo " " + echo "---- ${readme_group} ----" + cat _dockerlists_"${readme_group}".md +done + +# ------------- Update README.md ------------------ +# Get current date and Replace date in README.md +TODAY=$(date +%Y-%m-%d) +sed -i -r "s/(## Versions) \([0-9]{4}-[0-9]{2}-[0-9]{2}\)/\1 ($TODAY)/g" README.md +# Replace content between the special comments in README.md for each readme_group +for readme_group in $distinct_variants recent locked bundle0 test; do + echo "## ${readme_group} ##" + awk -v readme_group="$readme_group" -v content="$(<_dockerlists_"${readme_group}".md)" ' + $0 ~ "" {print; print content; f=1; next} + $0 ~ "" {f=0} + !f' README.md >tmp.md && mv tmp.md README.md +done + +# Check README.md size; for safe uploading to the docker hub; +# https://github.com/peter-evans/dockerhub-description/issues/69 +README_SIZE_LIMIT=25000 +file_size=$(stat --format=%s "README.md") +echo " " +echo "README.md size is $file_size bytes ( max limit $README_SIZE_LIMIT bytes )" +if [[ $file_size -ge $README_SIZE_LIMIT ]]; then + echo "WARNING: README.md is too large ($file_size bytes). " + echo " Must be less than $README_SIZE_LIMIT bytes!" + echo " The github API automatically truncates README.md files to $README_SIZE_LIMIT bytes." + echo " " +fi + +echo " " +echo "README.md updated " +echo " " diff --git a/apply-templates.sh b/apply-templates.sh new file mode 100755 index 00000000..857346b7 --- /dev/null +++ b/apply-templates.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +# Source environment variables and necessary configurations +source tools/environment_init.sh + +# This code derived from: +# - URL: https://github.com/docker-library/postgres/blob/master/apply-templates.sh +# - Copyright: (c) Docker PostgreSQL Authors +# - MIT License, https://github.com/docker-library/postgres/blob/master/LICENSE + +# Check dependencies +[ -f ./versions.json ] + +cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +jqt='.jq-template.awk' +if [ -n "${BASHBREW_SCRIPTS:-}" ]; then + jqt="$BASHBREW_SCRIPTS/jq-template.awk" +elif [ "${BASH_SOURCE[0]}" -nt "$jqt" ]; then + # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk + wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/9f6a35772ac863a0241f147c820354e4008edf38/scripts/jq-template.awk' +fi + +jqf='.template-helper-functions.jq' +if [ -n "${BASHBREW_SCRIPTS:-}" ]; then + jqf="$BASHBREW_SCRIPTS/template-helper-functions.jq" +elif [ "${BASH_SOURCE[0]}" -nt "$jqf" ]; then + wget -qO "$jqf" 'https://github.com/docker-library/bashbrew/raw/master/scripts/template-helper-functions.jq' +fi + +if [ "$#" -eq 0 ]; then + versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" + eval "set -- $versions" +fi + +echo "versions = $versions" + +generated_warning() { + cat <<-EOH + # + # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" + # source: "$1" + # PLEASE DO NOT EDIT IT DIRECTLY. + # + EOH +} + +for version; do + export version + + bundleType="$(echo "$version" | cut -d '-' -f 3)" + variants="$(jq -r '.[env.version]| keys | map(@sh) | join(" ")' versions.json)" + eval "variants=( $variants )" + + for variant in "${variants[@]}"; do + export variant + + dir="$version/$variant" + echo "processing $dir ..." + + template="$(jq -r '.[env.version][env.variant].template' versions.json)" + echo " template=$template" + + initfile="$(jq -r '.[env.version][env.variant].initfile' versions.json)" + echo " initfile=$initfile" + + tags="$(jq -r '.[env.version][env.variant].tags' versions.json)" + echo " tags=$tags" + + cp -a "$initfile" "$dir/" + if [ -z "$bundleType" ]; then + cp -a update-postgis.sh "$dir/" + fi + + echo "$tags" >"$dir/tags" + + { + generated_warning "$template" + gawk -f "$jqt" "$template" + } >"$dir/Dockerfile" + + done +done + +echo " " +echo " apply-template : done" +echo " " diff --git a/doc/developers.md b/doc/developers.md new file mode 100644 index 00000000..8ee1bacd --- /dev/null +++ b/doc/developers.md @@ -0,0 +1,34 @@ + +# Developer Documentation + +* 🧪 test images: https://hub.docker.com/r/imresamu/postgis +* 🧪 test github: https://github.com/ImreSamu/docker-postgis + +## Development Goals Prior to Public Discussion: + +- [x] Use Dockerfile templates and version.json, and follow best practices from the official PostgreSQL Dockerfiles as closely as possible. +- [x] Support for multiple Debian and Alpine releases (e.g., Buster, Bullseye, Alpine 3.18) +- [x] Release new Geo bundle version with pgRouting,MobilityDB,H3,... + - [ ] need more test, refactoring +- [x] Support multi tags + - `15-3.4-alpine3.18 15-3.4.0-alpine3.18 15-3.4-alpine alpine` + - `15-3.4-bundle-bookworm 15-3.4.0-bundle-bookworm 15-3.4-bundle bundle` + - `15-master-bookworm 15-master` +- [x] Special tags for the latest versions `alpine`,`bundle`,`latest` +- [x] Automatically update continuous integration (CI) scripts, and maintain `README.md` based on `./version.json` +- [x] Support development repositories with easier setup ( `.env` ) +- [ ] Implement multi-architecture multi-cloud support + - [x] Support amd64 via GitHub Actions `.github/workflows/main.yml` + - [x] Support arm64 via CircleCI (using native arm, not emulated) `.circleci/config.yml` + - [ ] Synchronize CI Tasks + - [ ] Handle manifest creation (complex task) +- [x] Shellcheck verify +- [x] Minimal test flow with local registy ( `./localtest.sh` ) +- [x] New Makefile; with `make help` +- [ ] Refactoring README.md ( Github API 25000 char limit ) +- [ ] Refactoring & Testing +- [ ] Provide developer documentation + + + +https://github.com/dvershinin/lastversion diff --git a/initdb-bundle0.sh b/initdb-bundle0.sh new file mode 100644 index 00000000..5f2c5d11 --- /dev/null +++ b/initdb-bundle0.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# install pg-svg-lib +"${psql[@]}" /dev/null" EXIT +trap 'docker rm -vf "$cid" > /dev/null' EXIT psql() { - docker run --rm -i \ - --link "$cname":postgis \ - --entrypoint psql \ - -e PGPASSWORD="$POSTGRES_PASSWORD" \ - "$image" \ - --host postgis \ - --username "$POSTGRES_USER" \ - --dbname "$POSTGRES_DB" \ - --quiet --no-align --tuples-only \ - "$@" + docker run --rm -i \ + --link "$cname":postgis \ + --entrypoint psql \ + -e PGPASSWORD="$POSTGRES_PASSWORD" \ + "$image" \ + --host postgis \ + --username "$POSTGRES_USER" \ + --dbname "$POSTGRES_DB" \ + --quiet --no-align --tuples-only \ + "$@" } -tries=10 -while ! echo 'SELECT 1' | psql &> /dev/null; do - (( tries-- )) - if [ $tries -le 0 ]; then - echo >&2 'postgres failed to accept connections in a reasonable amount of time!' - echo 'SELECT 1' | psql # to hopefully get a useful error message - false - fi - sleep 2 +# Set default values for POSTGRES_TEST_TRIES and POSTGRES_TEST_SLEEP if they are not set. +# You can change the default value of POSTGRES_TEST_TRIES and the POSTGRES_TEST_SLEEP in the CI build settings. +# For special cases like Buildx/qemu tests, you may need to set POSTGRES_TEST_TRIES to 42. +: "${POSTGRES_TEST_TRIES:=15}" +: "${POSTGRES_TEST_SLEEP:=2}" +tries="$POSTGRES_TEST_TRIES" +while ! echo 'SELECT 1' | psql &>/dev/null; do + ((tries--)) + if [ $tries -le 0 ]; then + echo >&2 'postgres failed to accept connections in a reasonable amount of time!' + echo 'SELECT 1' | psql # to hopefully get a useful error message + false + fi + sleep "$POSTGRES_TEST_SLEEP" done echo 'SELECT PostGIS_Version()' | psql [ "$(echo 'SELECT ST_X(ST_Point(0,0))' | psql)" = 0 ] - ## test address_standardizer extension echo 'CREATE EXTENSION address_standardizer;' | psql response=$(echo $'SELECT zip FROM parse_address(\'1 Devonshire Place, Boston, MA 02109-1234\') AS a;' | psql) -if [ $response = 02109 ]; then - echo "address_standardizer extension installed and works!" -else - echo "address_standardizer extension test failed, returned response is $response" - exit 1 +if [ "$response" = "02109" ]; then + echo "address_standardizer extension installed and works!" +else + echo "address_standardizer extension test failed, returned response is $response" + exit 1 fi +echo "CREATE EXTENSION IF NOT EXISTS postgis;" | psql +echo "CREATE EXTENSION IF NOT EXISTS postgis_raster;" | psql +echo "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;" | psql +echo "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;" | psql +echo "CREATE EXTENSION IF NOT EXISTS address_standardizer;" | psql +echo "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;" | psql +echo "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;" | psql +echo "CREATE EXTENSION IF NOT EXISTS postgis_topology;" | psql +echo "SELECT version();" | psql +echo "SELECT PostGIS_Full_Version();" | psql +echo "\dx" | psql diff --git a/test/tests/postgis-bundle/run.sh b/test/tests/postgis-bundle/run.sh new file mode 100755 index 00000000..1c51cf32 --- /dev/null +++ b/test/tests/postgis-bundle/run.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# shellcheck disable=SC2119,SC2120 +set -eo pipefail + +#for debug: +#set -x + +image="$1" + +export POSTGRES_USER='my cool postgis user' +export POSTGRES_PASSWORD='my cool postgis password' +export POSTGRES_DB='my cool postgis database' + +cname="postgis-container-$RANDOM-$RANDOM" +cid="$(docker run -d -e POSTGRES_USER -e POSTGRES_PASSWORD -e POSTGRES_DB --name "$cname" "$image")" +trap 'docker rm -vf "$cid" > /dev/null' EXIT + +psql() { + docker run --rm -i \ + --link "$cname":postgis \ + --entrypoint psql \ + -e PGPASSWORD="$POSTGRES_PASSWORD" \ + "$image" \ + --host postgis \ + --username "$POSTGRES_USER" \ + --dbname "$POSTGRES_DB" \ + --quiet --no-align --tuples-only \ + "$@" +} + +# Set default values for POSTGRES_TEST_TRIES and POSTGRES_TEST_SLEEP if they are not set. +# You can change the default value of POSTGRES_TEST_TRIES and the POSTGRES_TEST_SLEEP in the CI build settings. +# For special cases like Buildx/qemu tests, you may need to set POSTGRES_TEST_TRIES to 42. +: "${POSTGRES_TEST_TRIES:=15}" +: "${POSTGRES_TEST_SLEEP:=2}" +tries="$POSTGRES_TEST_TRIES" +while ! echo 'SELECT 1' | psql &>/dev/null; do + ((tries--)) + if [ $tries -le 0 ]; then + echo >&2 'postgres failed to accept connections in a reasonable amount of time!' + echo 'SELECT 1' | psql # to hopefully get a useful error message + false + fi + sleep "$POSTGRES_TEST_SLEEP" +done + +## Minimal create extension test +echo " +create extension if not exists asn1oid cascade; +create extension if not exists ddlx cascade; +create extension if not exists gzip cascade; +create extension if not exists h3 cascade; +create extension if not exists h3_postgis cascade; +create extension if not exists hstore_plpython3u cascade; +create extension if not exists http cascade; +create extension if not exists mobilitydb cascade; +create extension if not exists ogr_fdw cascade; +create extension if not exists pg_curl cascade; +create extension if not exists pg_uuidv7 cascade; +create extension if not exists pgrouting cascade; +create extension if not exists pgtap cascade; +create extension if not exists plpython3u cascade; +create extension if not exists prioritize cascade; +create extension if not exists q3c cascade; +create extension if not exists vector cascade; +" | psql + +echo " +SELECT h3_get_extension_version(); +SELECT mobilitydb_full_version(); +SELECT pgr_full_version(); +" | psql + +imagetag=$(echo "${1}" | cut -d':' -f2) +mkdir -p ./tmp + +echo " +COPY ( + SELECT + name, default_version, comment + FROM pg_available_extensions ORDER BY 1 +) TO STDOUT WITH CSV HEADER; +" | psql >./tmp/"${imagetag}"__pg_available_extensions.csv diff --git a/tools/environment_init.sh b/tools/environment_init.sh new file mode 100755 index 00000000..1657e36e --- /dev/null +++ b/tools/environment_init.sh @@ -0,0 +1,140 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +# Check if IMAGE_VERSION_ID is already set +if [ -n "${IMAGE_VERSION_ID:-}" ]; then + # note: Script already ran, exiting early. + return 0 +fi + +# Load .env files config. +set -a +if [[ "${TEST:-}" == "true" ]]; then + # shellcheck disable=SC1091 + source .env.test + echo "TEST MODE!" +else + # shellcheck disable=SC1091 + source .env +fi +set +a + +if [ -z "$REGISTRY" ] || [ -z "$REPO_NAME" ] || [ -z "$IMAGE_NAME" ]; then + echo "Error: REGISTRY,REPO_NAME and IMAGE_NAME must be set" >&2 + exit 1 +fi + +# Determine IMAGE_ARCH based on the machine architecture +if [[ "$(uname -m)" == "x86_64" ]]; then + IMAGE_ARCH=amd64 +elif [[ "$(uname -m)" == "aarch64" ]]; then + IMAGE_ARCH=arm64 +else + echo "Architecture not supported: $(uname -m)" + exit 1 +fi +export IMAGE_ARCH + +# create README.md image name ( no arch!) +README_IMAGE_NAME="${REGISTRY}/${REPO_NAME}/${IMAGE_NAME}" +export README_IMAGE_NAME + +# Modify IMAGE_NAME if ENABLE_IMAGE_ARCH is set to true +if [[ "${ENABLE_IMAGE_ARCH:-}" == "true" ]]; then + IMAGE_NAME="${IMAGE_NAME}-${IMAGE_ARCH}" +fi +export IMAGE_NAME + +# Override the default values of variables +# by setting the corresponding environment variables, if needed. +if [[ "$REGISTRY" == "docker.io" ]]; then + dockername="${REPO_NAME}/${IMAGE_NAME}" +else + dockername="${REGISTRY}/${REPO_NAME}/${IMAGE_NAME}" + +fi +export dockername + +# Initialize IMAGE_VERSION_ID as an empty string +IMAGE_VERSION_ID="" +# Generate IMAGE_VERSION_ID if ENABLE_IMAGE_VERSION_ID is set to true +if [[ "${ENABLE_IMAGE_VERSION_ID:-}" == "true" ]]; then + # Note: Make sure to keep this synchronized with the corresponding section in Makefile + COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y%m%d) + COMMIT_HASH=$(git log -1 --pretty=format:%h) + BUILD_WEEK=$(date '+%Yw%V') + IMAGE_VERSION_ID="-ver${COMMIT_DATE}-${COMMIT_HASH}-${BUILD_WEEK}" +fi +export IMAGE_VERSION_ID + +echo " ---- .env file loaded ----" +echo " - REGISTRY : $REGISTRY" +echo " - REPO_NAME : $REPO_NAME" +echo " - IMAGE_NAME : $IMAGE_NAME" +echo " - IMAGE_ARCH : $IMAGE_ARCH" +echo " - dockername : ${dockername}" +echo " - IMAGE_VERSION_ID: ${IMAGE_VERSION_ID}" +echo " " + +# Verify that the required command-line tools (jq, gawk, python3, .. ) are available in the system's PATH. +# Exit with an error message if any of them are missing. +for cmd in docker jq gawk curl python3 manifest-tool lastversion; do + if ! command -v "$cmd" &>/dev/null; then + echo "Error: $cmd is not installed." + exit 1 + fi +done + +# Ensure that the necessary Python modules (yaml, json) are installed and can be imported. +# Exit with an error message if any of them are missing. +if ! python3 -c 'import yaml, json' &>/dev/null; then + echo "Error: Required python3 modules (yaml or json) are not installed." + echo " Please install them using 'pip3 install yaml json'." + exit 1 +fi + +# Define a function to check for the existence of a Docker image tag. +# Usage: +# check_image_exists "tag" +# +# This function uses `manifest-tool` to inspect the image manifest. It is a more reliable way to check +# for image existence across different platforms and registries without requiring the image to be pulled locally. +# +# The function prints a message indicating whether the image-tag exists and returns an exit code. +# Exit code 0 indicates that the image-tag exists, while 1 indicates non-existence. +function check_image_exists() { + local image_name="${dockername}:$1" + local output + local secure_opt="" + + # Check if dockername contains 'localhost:5000' + if [[ $dockername == *"localhost:5000"* ]]; then + echo "The name contains 'localhost:5000' ; insecure and plain-http mode is enabled !" + secure_opt=(--insecure --plain-http) + else + secure_opt=() + fi + + # Attempt to inspect the image using manifest-tool. Capture the output, including any errors. + output=$(manifest-tool "${secure_opt[@]}" inspect "$image_name" 2>&1 || true) + + echo "" + echo "--[ manifest-tool inspect $image_name ]---" + echo "$output" + echo "--[ manifest-tool inspect $image_name ]---" + echo "" + + # Check the output for a "not found" message, which indicates the image does not exist. + if echo "$output" | grep -q "not found"; then + echo "The Docker image '$image_name' does not exist." + return 1 # Return an exit code of 1 to signify the image does not exist. + elif echo "$output" | grep -q "digest"; then + echo "The Docker image '$image_name' exists." + return 0 + else + echo "unknow error" + return 1 + fi +} + +export -f check_image_exists diff --git a/tools/get_versions_changes.sh b/tools/get_versions_changes.sh new file mode 100755 index 00000000..bd4c7596 --- /dev/null +++ b/tools/get_versions_changes.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -Eeuo pipefail + +# Get changed versions from git diff +# used by auto update CI : .github/workflows/update.yml + +# example outputs: DUCKDB:v0.10.1,MOBILITYDB:v1.1.0 + +git diff versions.json | + grep "^+" | + sed 's/^+//' | + grep -E "_CHECKOUT|_VERSION" | + grep -vE "_SHA1" | + sed 's/_CHECKOUT"//g;s/_VERSION"//g' | + sed 's# "tags/##g' | + sed 's#"##g' | + sed 's# ##g' | + sed 's#,##g' | + sort | uniq | + awk 'BEGIN { ORS=""; print ""; total_length=0; } { word_length=length($0)+1; if (total_length+word_length<=80) { print (NR>1?",":"") $0; total_length+=word_length; } else { exit; } }' diff --git a/tools/install_dive.sh b/tools/install_dive.sh new file mode 100755 index 00000000..a7a09789 --- /dev/null +++ b/tools/install_dive.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -Eeuo pipefail + +# https://github.com/wagoodman/dive/releases/tag/v0.12.0 +version="0.12.0" + +# Determine IMAGE_ARCH based on the machine architecture +if [[ "$(uname -m)" == "x86_64" ]]; then + IMAGE_ARCH=amd64 + checksum="20a7966523a0905f950c4fbf26471734420d6788cfffcd4a8c4bc972fded3e96 tools/dive_0.12.0_linux_amd64.tar.gz" +elif [[ "$(uname -m)" == "aarch64" ]]; then + IMAGE_ARCH=arm64 + checksum="a2a1470302cdfa367a48f80b67bbf11c0cd8039af9211e39515bd2bbbda58fea tools/dive_0.12.0_linux_arm64.tar.gz" +else + echo "Architecture not supported: $(uname -m)" + exit 1 +fi + +# Download wagoodman/dive tool +rm -f "tools/dive" +rm -f "tools/dive_${version}_linux_${IMAGE_ARCH}.tar.gz" +wget https://github.com/wagoodman/dive/releases/download/v${version}/dive_${version}_linux_${IMAGE_ARCH}.tar.gz -O tools/dive_${version}_linux_${IMAGE_ARCH}.tar.gz +echo "${checksum}" | sha256sum --check +tar -xzf "tools/dive_${version}_linux_${IMAGE_ARCH}.tar.gz" -C "tools/" +chmod +x "tools/dive" +rm -f "tools/dive_${version}_linux_${IMAGE_ARCH}.tar.gz" + +# Check dive version +tools/dive -v diff --git a/tools/install_manifest-tool.sh b/tools/install_manifest-tool.sh new file mode 100755 index 00000000..c3de5e5b --- /dev/null +++ b/tools/install_manifest-tool.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -Eeuo pipefail + +# https://github.com/estesp/manifest-tool +version="2.1.8" + +# Determine IMAGE_ARCH based on the machine architecture +if [[ "$(uname -m)" == "x86_64" ]]; then + IMAGE_ARCH=amd64 +elif [[ "$(uname -m)" == "aarch64" ]]; then + IMAGE_ARCH=arm64 +else + echo "Architecture not supported: $(uname -m)" + exit 1 +fi +export IMAGE_ARCH + +# Download manifest-tool +wget https://github.com/estesp/manifest-tool/releases/download/v${version}/binaries-manifest-tool-${version}.tar.gz +mkdir -p manifest-tool +tar -xvzf binaries-manifest-tool-${version}.tar.gz -C manifest-tool +sudo mv manifest-tool/manifest-tool-linux-${IMAGE_ARCH} /usr/local/bin/manifest-tool +rm -f binaries-manifest-tool-${version}.tar.gz +rm -rf ./manifest-tool/manifest-tool-* # remove other archs + +# Check manifest-tool version +manifest-tool -v diff --git a/tools/install_shellcheck.sh b/tools/install_shellcheck.sh new file mode 100755 index 00000000..258126e7 --- /dev/null +++ b/tools/install_shellcheck.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -Eeuo pipefail + +# https://github.com/koalaman/shellcheck#installing-a-pre-compiled-binary + +scversion="stable" # or "v0.4.7", or "latest" +wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv +cp "shellcheck-${scversion}/shellcheck" /usr/bin/ +shellcheck --version diff --git a/update.sh b/update.sh index d7f8f48e..f13d7045 100755 --- a/update.sh +++ b/update.sh @@ -1,199 +1,28 @@ -#!/bin/bash -# Derived from https://github.com/docker-library/postgres/blob/master/update.sh +#!/usr/bin/env bash set -Eeuo pipefail +# Source environment variables and necessary configurations +source tools/environment_init.sh -cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" +# This code derived from: +# - URL: https://github.com/docker-library/postgres/blob/master/versions.sh +# - Copyright: (c) Docker PostgreSQL Authors +# - MIT License, https://github.com/docker-library/postgres/blob/master/LICENSE -versions=( "$@" ) -if [ ${#versions[@]} -eq 0 ]; then - versions=( */Dockerfile ) -fi -versions=( "${versions[@]%/Dockerfile}" ) +cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -for optimized in debian alpine test; do - rm -f _dockerlists_${optimized}.md - echo " " > _dockerlists_${optimized}.md - echo "| DockerHub image | Dockerfile | OS | Postgres | PostGIS |" >> _dockerlists_${optimized}.md - echo "| --------------- | ---------- | -- | -------- | ------- |" >> _dockerlists_${optimized}.md -done - -autogenerated='NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY.' - -dockerhublink="https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=" -githubrepolink="https://github.com/postgis/docker-postgis/blob/master" - -# sort version numbers with highest last (so it goes first in .travis.yml) -IFS=$'\n'; versions=( $(echo "${versions[*]}" | sort -V) ); unset IFS - -defaultAlpinenSuite='3.18' -defaultDebianSuite='bullseye-slim' -declare -A debianSuite=( - # https://github.com/docker-library/postgres/issues/582 - [11]='bullseye-slim' - [12]='bullseye-slim' - [13]='bullseye-slim' - [14]='bullseye-slim' - [15]='bullseye-slim' - [16]='bullseye-slim' -) - -defaultPostgisDebPkgNameVersionSuffix='3' -declare -A postgisDebPkgNameVersionSuffixes=( - [3.0]='3' - [3.1]='3' - [3.2]='3' - [3.3]='3' - [3.4]='3' -) - -packagesBase='http://apt.postgresql.org/pub/repos/apt/dists/' - -cgal5XGitHash="$(git ls-remote https://github.com/CGAL/cgal.git heads/5.6.x-branch | awk '{ print $1}')" -sfcgalGitHash="$(git ls-remote https://gitlab.com/Oslandia/SFCGAL.git heads/master | awk '{ print $1}')" -projGitHash="$(git ls-remote https://github.com/OSGeo/PROJ.git heads/master | awk '{ print $1}')" -gdalGitHash="$(git ls-remote https://github.com/OSGeo/gdal.git refs/heads/master | grep '\srefs/heads/master' | awk '{ print $1}')" -geosGitHash="$(git ls-remote https://github.com/libgeos/geos.git heads/main | awk '{ print $1}')" -postgisGitHash="$(git ls-remote https://github.com/postgis/postgis.git heads/master | awk '{ print $1}')" - -declare -A suitePackageList=() suiteArches=() -for version in "${versions[@]}"; do - IFS=- read postgresVersion postgisVersion <<< "$version" - - echo " " - echo "---- generate Dockerfile for $version ----" - echo "postgresVersion=$postgresVersion" - echo "postgisVersion=$postgisVersion" - - if [ "2.5" == "$postgisVersion" ]; then - # posgis 2.5 only in the stretch ; no bullseye version - tag='stretch-slim' - else - tag="${debianSuite[$postgresVersion]:-$defaultDebianSuite}" - fi - suite="${tag%%-slim}" - - if [ -z "${suitePackageList["$suite"]:+isset}" ]; then - suitePackageList["$suite"]="$(curl -fsSL "${packagesBase}/${suite}-pgdg/main/binary-amd64/Packages.bz2" | bunzip2)" - fi - if [ -z "${suiteArches["$suite"]:+isset}" ]; then - suiteArches["$suite"]="$(curl -fsSL "${packagesBase}/${suite}-pgdg/Release" | awk -F ':[[:space:]]+' '$1 == "Architectures" { gsub(/[[:space:]]+/, "|", $2); print $2 }')" - fi - - postgresVersionMain="$(echo "$postgresVersion" | awk -F 'alpha|beta|rc' '{print $1}')" - versionList="$(echo "${suitePackageList["$suite"]}"; curl -fsSL "${packagesBase}/${suite}-pgdg/${postgresVersionMain}/binary-amd64/Packages.bz2" | bunzip2)" - fullVersion="$(echo "$versionList" | awk -F ': ' '$1 == "Package" { pkg = $2 } $1 == "Version" && pkg == "postgresql-'"$postgresVersionMain"'" { print $2; exit }' || true)" - - if [ "$suite" = "bullseye" ]; then - boostVersion="1.74.0" - else - echo "Unknown debian version; stop" - exit 1 - fi - - - optimized="" - if [[ "$version" =~ "alpha" || "$version" =~ "beta" || "$version" =~ "rc" || "$version" =~ "master" ]]; - then - optimized="test" - else - optimized="debian" - fi - echo "optimized=$optimized" - - debianPostgisMajMin="" - if [ "master" == "$postgisVersion" ]; then - postgisPackageName="" - postgisFullVersion="$postgisVersion" - postgisMajor="" - postgisDocSrc="development: postgis, geos, proj, gdal" - else - postgisMajMin="$( echo "${postgisVersion}" | cut -d. -f1 ).$( echo "${postgisVersion}" | cut -d. -f2 )" - echo "postgisMajMin=${postgisMajMin}" - - postgisPackageName="postgresql-${postgresVersionMain}-postgis-${postgisDebPkgNameVersionSuffixes[${postgisMajMin}]}" - postgisFullVersion="$(echo "$versionList" | awk -F ': ' '$1 == "Package" { pkg = $2 } $1 == "Version" && pkg == "'"$postgisPackageName"'" { print $2; exit }' || true)" - echo "postgisPackageName=${postgisPackageName}" - echo "postgisFullVersion=${postgisFullVersion}" - - debianPostgisMajMin="$( echo "${postgisFullVersion}" | cut -d. -f1 ).$( echo "${postgisFullVersion}" | cut -d. -f2 )" - - if [ "$debianPostgisMajMin" == "$postgisMajMin" ]; then - echo "debian postgis version is OK " - postgisMajor="${postgisDebPkgNameVersionSuffixes[${postgisMajMin}]}" - postgisDocSrc="${postgisFullVersion%%+*}" - else - echo "debian postgis is not updated, different .. " - postgisFullVersion="" - postgisMajor="" - postgisDocSrc="" - fi - fi - - if [ -z "$postgisFullVersion" ] - then - echo "SKIP debian version"; - # debain version not found; - echo " # placeholder Dockerfile" > "$version/Dockerfile" - echo " # Debian version of postgis $postgisFullVersion is not detected!">> "$version/Dockerfile" - echo " # This is an autogenerated message of ./update.sh " >> "$version/Dockerfile" - rm -f "$version/*.sh" - rm -f "$version/*.md" - # use the default for the alpine version - postgisFullVersion=$postgisVersion - postgisDocSrc=$postgisVersion - else - ( - set -x - cp -p initdb-postgis.sh update-postgis.sh "$version/" - if [ "master" == "$postgisVersion" ]; then - cat Dockerfile.master.template > "$version/Dockerfile" - else - cat Dockerfile.template > "$version/Dockerfile" - fi - sed -i 's/%%TXT_AUTOGENERATED%%/'"$autogenerated"'/g; s/%%PG_MAJOR%%/'$postgresVersion'/g; s/%%POSTGIS_MAJOR%%/'$postgisMajor'/g; s/%%POSTGIS_VERSION%%/'$postgisFullVersion'/g; s/%%POSTGIS_GIT_HASH%%/'$postgisGitHash'/g; s/%%CGAL5X_GIT_HASH%%/'$cgal5XGitHash'/g; s/%%SFCGAL_GIT_HASH%%/'$sfcgalGitHash'/g; s/%%PROJ_GIT_HASH%%/'$projGitHash'/g; s/%%GDAL_GIT_HASH%%/'$gdalGitHash'/g; s/%%GEOS_GIT_HASH%%/'$geosGitHash'/g; s/%%BOOST_VERSION%%/'"$boostVersion"'/g; s/%%DEBIAN_VERSION%%/'"$suite"'/g;' "$version/Dockerfile" - - echo "| [postgis/postgis:${version}](${dockerhublink}${version}) | [Dockerfile](${githubrepolink}/${version}/Dockerfile) | debian:${suite} | ${postgresVersion} | ${postgisDocSrc} |" >> _dockerlists_${optimized}.md - ) - fi +echo " " - if [ "master" == "$postgisVersion" ]; then - srcVersion="" - srcSha256="" - else - srcVersion="${postgisFullVersion%%+*}" - srcSha256="$(curl -sSL "https://github.com/postgis/postgis/archive/$srcVersion.tar.gz" | sha256sum | awk '{ print $1 }')" - fi - for variant in alpine; do - if [ ! -d "$version/$variant" ]; then - continue - fi - ( - set -x - if [ "$optimized" != "test" ]; then - optimized="alpine" - fi - cp -p Dockerfile.alpine.template initdb-postgis.sh update-postgis.sh "$version/$variant/" - mv "$version/$variant/Dockerfile.alpine.template" "$version/$variant/Dockerfile" - sed -i 's/%%TXT_AUTOGENERATED%%/'"$autogenerated"'/g; s/%%PG_MAJOR%%/'"$postgresVersion"'/g; s/%%POSTGIS_VERSION%%/'"$srcVersion"'/g; s/%%POSTGIS_SHA256%%/'"$srcSha256"'/g' "$version/$variant/Dockerfile" +# Generate versions.json metadata file +./versions.sh "$@" - echo "| [postgis/postgis:${version}-${variant}](${dockerhublink}${version}-${variant}) | [Dockerfile](${githubrepolink}/${version}/${variant}/Dockerfile) | alpine:${defaultAlpinenSuite} | ${postgresVersion} | ${postgisDocSrc} |" >> _dockerlists_${optimized}.md - ) - done -done +# apply version.json - generate Dockerfiles +./apply-templates.sh "$@" -echo "|-------------------------|" -echo "|- Generated images -|" -echo "|-------------------------|" +# apply version.json - generate .github/workflows/main.yml and .circleci/config.yml +./apply-ci.sh "$@" -for optimized in debian alpine test; do - echo " " - echo "---- ${optimized} ----" - cat _dockerlists_${optimized}.md -done +# apply version.json - generate manifest.sh +./apply-manifest.sh "$@" -echo " " -echo "Postprocessing todo:" -echo "- add the new versions to README.md ( manually )" -ls -la _dockerlists_*.md -echo " " -echo " - done - " +# apply version.json - generate README.md +./apply-readme.sh "$@" diff --git a/versions.json b/versions.json new file mode 100644 index 00000000..4c408ee0 --- /dev/null +++ b/versions.json @@ -0,0 +1,729 @@ +{ + "12-3.3": { + "alpine3.20": { + "tags": "12-3.3-alpine3.20 12-3.3.7-alpine3.20 12-3.3-alpine", + "readme_group": "alpine3.20", + "postgis": "3.3", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "12", + "PG_DOCKER": "12", + "POSTGIS_VERSION": "3.3.7", + "POSTGIS_SHA256": "faa796035df95e1dac5a92ebe7090b2865d36128cdf6feb36643914f8056ad80", + "POSTGIS_CHECKOUT": "tags/3.3.7", + "POSTGIS_CHECKOUT_SHA1": "a0c796766cbcd369d871283f559fd97a186464dd" + } + }, + "12-3.4": { + "alpine3.19": { + "tags": "12-3.4-alpine3.19 12-3.4.3-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "12", + "PG_DOCKER": "12", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + }, + "alpine3.20": { + "tags": "12-3.4-alpine3.20 12-3.4.3-alpine3.20 12-3.4-alpine", + "readme_group": "alpine3.20", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "12", + "PG_DOCKER": "12", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + } + }, + "12-3.5": { + "bullseye": { + "tags": "12-3.5-bullseye 12-3.5.0-bullseye", + "postgis": "3.5", + "readme_group": "bullseye", + "PG_MAJOR": "12", + "PG_DOCKER": "12", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg110+1" + }, + "bookworm": { + "tags": "12-3.5-bookworm 12-3.5.0-bookworm 12-3.5", + "postgis": "3.5", + "readme_group": "bookworm", + "PG_MAJOR": "12", + "PG_DOCKER": "12", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg120+1" + }, + "alpine3.19": { + "tags": "12-3.5-alpine3.19 12-3.5.0-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "12", + "PG_DOCKER": "12", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + }, + "alpine3.20": { + "tags": "12-3.5-alpine3.20 12-3.5.0-alpine3.20 12-3.5-alpine", + "readme_group": "alpine3.20", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "12", + "PG_DOCKER": "12", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + } + }, + "13-3.3": { + "alpine3.20": { + "tags": "13-3.3-alpine3.20 13-3.3.7-alpine3.20 13-3.3-alpine", + "readme_group": "alpine3.20", + "postgis": "3.3", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "13", + "PG_DOCKER": "13", + "POSTGIS_VERSION": "3.3.7", + "POSTGIS_SHA256": "faa796035df95e1dac5a92ebe7090b2865d36128cdf6feb36643914f8056ad80", + "POSTGIS_CHECKOUT": "tags/3.3.7", + "POSTGIS_CHECKOUT_SHA1": "a0c796766cbcd369d871283f559fd97a186464dd" + } + }, + "13-3.4": { + "alpine3.19": { + "tags": "13-3.4-alpine3.19 13-3.4.3-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "13", + "PG_DOCKER": "13", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + }, + "alpine3.20": { + "tags": "13-3.4-alpine3.20 13-3.4.3-alpine3.20 13-3.4-alpine", + "readme_group": "alpine3.20", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "13", + "PG_DOCKER": "13", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + } + }, + "13-3.5": { + "bullseye": { + "tags": "13-3.5-bullseye 13-3.5.0-bullseye", + "postgis": "3.5", + "readme_group": "bullseye", + "PG_MAJOR": "13", + "PG_DOCKER": "13", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg110+1" + }, + "bookworm": { + "tags": "13-3.5-bookworm 13-3.5.0-bookworm 13-3.5", + "postgis": "3.5", + "readme_group": "bookworm", + "PG_MAJOR": "13", + "PG_DOCKER": "13", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg120+1" + }, + "alpine3.19": { + "tags": "13-3.5-alpine3.19 13-3.5.0-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "13", + "PG_DOCKER": "13", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + }, + "alpine3.20": { + "tags": "13-3.5-alpine3.20 13-3.5.0-alpine3.20 13-3.5-alpine", + "readme_group": "alpine3.20", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "13", + "PG_DOCKER": "13", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + } + }, + "14-3.3": { + "alpine3.20": { + "tags": "14-3.3-alpine3.20 14-3.3.7-alpine3.20 14-3.3-alpine", + "readme_group": "alpine3.20", + "postgis": "3.3", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "14", + "PG_DOCKER": "14", + "POSTGIS_VERSION": "3.3.7", + "POSTGIS_SHA256": "faa796035df95e1dac5a92ebe7090b2865d36128cdf6feb36643914f8056ad80", + "POSTGIS_CHECKOUT": "tags/3.3.7", + "POSTGIS_CHECKOUT_SHA1": "a0c796766cbcd369d871283f559fd97a186464dd" + } + }, + "14-3.4": { + "alpine3.19": { + "tags": "14-3.4-alpine3.19 14-3.4.3-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "14", + "PG_DOCKER": "14", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + }, + "alpine3.20": { + "tags": "14-3.4-alpine3.20 14-3.4.3-alpine3.20 14-3.4-alpine", + "readme_group": "alpine3.20", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "14", + "PG_DOCKER": "14", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + } + }, + "14-3.5": { + "bullseye": { + "tags": "14-3.5-bullseye 14-3.5.0-bullseye", + "postgis": "3.5", + "readme_group": "bullseye", + "PG_MAJOR": "14", + "PG_DOCKER": "14", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg110+1" + }, + "bookworm": { + "tags": "14-3.5-bookworm 14-3.5.0-bookworm 14-3.5", + "postgis": "3.5", + "readme_group": "bookworm", + "PG_MAJOR": "14", + "PG_DOCKER": "14", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg120+1" + }, + "alpine3.19": { + "tags": "14-3.5-alpine3.19 14-3.5.0-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "14", + "PG_DOCKER": "14", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + }, + "alpine3.20": { + "tags": "14-3.5-alpine3.20 14-3.5.0-alpine3.20 14-3.5-alpine", + "readme_group": "alpine3.20", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "14", + "PG_DOCKER": "14", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + } + }, + "15-3.3": { + "alpine3.20": { + "tags": "15-3.3-alpine3.20 15-3.3.7-alpine3.20 15-3.3-alpine", + "readme_group": "alpine3.20", + "postgis": "3.3", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "15", + "PG_DOCKER": "15", + "POSTGIS_VERSION": "3.3.7", + "POSTGIS_SHA256": "faa796035df95e1dac5a92ebe7090b2865d36128cdf6feb36643914f8056ad80", + "POSTGIS_CHECKOUT": "tags/3.3.7", + "POSTGIS_CHECKOUT_SHA1": "a0c796766cbcd369d871283f559fd97a186464dd" + } + }, + "15-3.4": { + "alpine3.19": { + "tags": "15-3.4-alpine3.19 15-3.4.3-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "15", + "PG_DOCKER": "15", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + }, + "alpine3.20": { + "tags": "15-3.4-alpine3.20 15-3.4.3-alpine3.20 15-3.4-alpine", + "readme_group": "alpine3.20", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "15", + "PG_DOCKER": "15", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + } + }, + "15-3.5": { + "bullseye": { + "tags": "15-3.5-bullseye 15-3.5.0-bullseye", + "postgis": "3.5", + "readme_group": "bullseye", + "PG_MAJOR": "15", + "PG_DOCKER": "15", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg110+1" + }, + "bookworm": { + "tags": "15-3.5-bookworm 15-3.5.0-bookworm 15-3.5", + "postgis": "3.5", + "readme_group": "bookworm", + "PG_MAJOR": "15", + "PG_DOCKER": "15", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg120+1" + }, + "alpine3.19": { + "tags": "15-3.5-alpine3.19 15-3.5.0-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "15", + "PG_DOCKER": "15", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + }, + "alpine3.20": { + "tags": "15-3.5-alpine3.20 15-3.5.0-alpine3.20 15-3.5-alpine", + "readme_group": "alpine3.20", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "15", + "PG_DOCKER": "15", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + } + }, + "16-3.3": { + "alpine3.20": { + "tags": "16-3.3-alpine3.20 16-3.3.7-alpine3.20 16-3.3-alpine", + "readme_group": "alpine3.20", + "postgis": "3.3", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "POSTGIS_VERSION": "3.3.7", + "POSTGIS_SHA256": "faa796035df95e1dac5a92ebe7090b2865d36128cdf6feb36643914f8056ad80", + "POSTGIS_CHECKOUT": "tags/3.3.7", + "POSTGIS_CHECKOUT_SHA1": "a0c796766cbcd369d871283f559fd97a186464dd" + } + }, + "16-3.4": { + "alpine3.19": { + "tags": "16-3.4-alpine3.19 16-3.4.3-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + }, + "alpine3.20": { + "tags": "16-3.4-alpine3.20 16-3.4.3-alpine3.20 16-3.4-alpine", + "readme_group": "alpine3.20", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + } + }, + "16-3.5": { + "bullseye": { + "tags": "16-3.5-bullseye 16-3.5.0-bullseye", + "postgis": "3.5", + "readme_group": "bullseye", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg110+1" + }, + "bookworm": { + "tags": "16-3.5-bookworm 16-3.5.0-bookworm 16-3.5", + "postgis": "3.5", + "readme_group": "bookworm", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg120+1" + }, + "alpine3.19": { + "tags": "16-3.5-alpine3.19 16-3.5.0-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + }, + "alpine3.20": { + "tags": "16-3.5-alpine3.20 16-3.5.0-alpine3.20 16-3.5-alpine", + "readme_group": "alpine3.20", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + } + }, + "16-3.5-bundle0": { + "bookworm": { + "tags": "16-3.5-bundle0-bookworm 16-3.5.0-bundle0-bookworm 16-3.5-bundle0", + "postgis": "3.5", + "readme_group": "bundle0", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "arch": "amd64 arm64", + "template": "Dockerfile.bundle0.template", + "initfile": "initdb-bundle0.sh", + "MOBILITYDB_CHECKOUT": "tags/v1.2.0", + "MOBILITYDB_CHECKOUT_SHA1": "60048b5b4b7ce2f7560c024d1af024db73b3bd5b", + "PGSQL_HTTP_CHECKOUT": "tags/v1.6.1", + "PGSQL_HTTP_CHECKOUT_SHA1": "5e2bd270a9ce2b0e8e1fdf8e46b85396bd4125cd", + "PGSQL_GZIP_CHECKOUT": "tags/v1.0.0", + "PGSQL_GZIP_CHECKOUT_SHA1": "7c26e8b0056631ec0bb7c8fdd9bf2a24076e4a49", + "TIMESCALEDB_CHECKOUT": "tags/2.17.2", + "TIMESCALEDB_CHECKOUT_SHA1": "b359d26de186ea43f93c28c08cd1b8c6449c91bd", + "DUCKDB_CHECKOUT": "tags/v1.1.3", + "DUCKDB_CHECKOUT_SHA1": "19864453f7d0ed095256d848b46e7b8630989bac", + "PG_HINT_PLAN_CHECKOUT": "tags/REL16_1_6_1", + "PG_HINT_PLAN_CHECKOUT_SHA1": "54b4b0358a6c96dc80b2b836bba50937415753b6", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg120+1" + } + }, + "16-master": { + "bookworm": { + "tags": "16-master-bookworm 16-master", + "postgis": "master", + "readme_group": "test", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "arch": "amd64 arm64", + "template": "Dockerfile.master.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_CHECKOUT": "master", + "POSTGIS_CHECKOUT_SHA1": "nocheck", + "CGAL_CHECKOUT": "master", + "CGAL_CHECKOUT_SHA1": "nocheck", + "SFCGAL_CHECKOUT": "master", + "SFCGAL_CHECKOUT_SHA1": "nocheck", + "PROJ_CHECKOUT": "master", + "PROJ_CHECKOUT_SHA1": "nocheck", + "GDAL_BUILD": "with_extra", + "GDAL_CHECKOUT": "master", + "GDAL_CHECKOUT_SHA1": "nocheck", + "GEOS_CHECKOUT": "main", + "GEOS_CHECKOUT_SHA1": "nocheck", + "BOOST_VERSION": "1.74.0" + } + }, + "16-recent": { + "bookworm": { + "tags": "16-recent-bookworm 16-recent-postgis3.5.0-geos3.13.0-proj9.5.0-gdal3.10.0-cgal6.0.1-sfcgal2.0.0-bookworm 16-recent-postgis3.5-geos3.13-proj9.5-gdal3.10-cgal6.0-sfcgal2.0-bookworm 16-recent", + "postgis": "recent", + "readme_group": "recent", + "PG_MAJOR": "16", + "PG_DOCKER": "16", + "arch": "amd64 arm64", + "template": "Dockerfile.master.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16", + "PROJ_CHECKOUT": "tags/9.5.0", + "PROJ_CHECKOUT_SHA1": "0a407325fbb5bf42407a7dc5d4f948be9707e302", + "GDAL_BUILD": "with_extra", + "GDAL_CHECKOUT": "tags/v3.10.0", + "GDAL_CHECKOUT_SHA1": "35a44cc570cdf4dbd55611e4bd61da76e56bc221", + "GEOS_CHECKOUT": "tags/3.13.0", + "GEOS_CHECKOUT_SHA1": "d7957246c588aa9c690efe67924fd70e741a06ab", + "SFCGAL_CHECKOUT": "tags/v2.0.0", + "SFCGAL_CHECKOUT_SHA1": "5d4eb5e896c41e592534ba1e79ccc721c66d66e3", + "CGAL_CHECKOUT": "tags/v6.0.1", + "CGAL_CHECKOUT_SHA1": "50cfbde3b84dbeae8338268db2d78fe4fcb522de", + "BOOST_VERSION": "1.74.0" + } + }, + "17-3.4": { + "alpine3.20": { + "tags": "17-3.4-alpine3.20 17-3.4.3-alpine3.20 17-3.4-alpine", + "readme_group": "alpine3.20", + "postgis": "3.4", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "17", + "PG_DOCKER": "17", + "POSTGIS_VERSION": "3.4.3", + "POSTGIS_SHA256": "802e1626252d12ec1d29261b95bf62930e1859587e44cad28d65b897a8d9ee6b", + "POSTGIS_CHECKOUT": "tags/3.4.3", + "POSTGIS_CHECKOUT_SHA1": "e36594574671877ca6178c944e6d430f87f310bf" + } + }, + "17-3.5": { + "bullseye": { + "tags": "17-3.5-bullseye 17-3.5.0-bullseye", + "postgis": "3.5", + "readme_group": "bullseye", + "PG_MAJOR": "17", + "PG_DOCKER": "17", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg110+1" + }, + "bookworm": { + "tags": "17-3.5-bookworm 17-3.5.0-bookworm 17-3.5 latest", + "postgis": "3.5", + "readme_group": "bookworm", + "PG_MAJOR": "17", + "PG_DOCKER": "17", + "arch": "amd64 arm64", + "template": "Dockerfile.debian.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_MAJOR": "3", + "POSTGIS_VERSION": "3.5.0+dfsg-1.pgdg120+1" + }, + "alpine3.19": { + "tags": "17-3.5-alpine3.19 17-3.5.0-alpine3.19", + "readme_group": "alpine3.19", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "17", + "PG_DOCKER": "17", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + }, + "alpine3.20": { + "tags": "17-3.5-alpine3.20 17-3.5.0-alpine3.20 17-3.5-alpine alpine", + "readme_group": "alpine3.20", + "postgis": "3.5", + "arch": "amd64 arm64", + "template": "Dockerfile.alpine.template", + "initfile": "initdb-postgis.sh", + "PG_MAJOR": "17", + "PG_DOCKER": "17", + "POSTGIS_VERSION": "3.5.0", + "POSTGIS_SHA256": "a47b8415ab88437390eba28e51b993cf0a2357057c277eea00378b8b76ab2316", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16" + } + }, + "17-master": { + "bookworm": { + "tags": "17-master-bookworm 17-master", + "postgis": "master", + "readme_group": "test", + "PG_MAJOR": "17", + "PG_DOCKER": "17", + "arch": "amd64 arm64", + "template": "Dockerfile.master.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_CHECKOUT": "master", + "POSTGIS_CHECKOUT_SHA1": "nocheck", + "CGAL_CHECKOUT": "master", + "CGAL_CHECKOUT_SHA1": "nocheck", + "SFCGAL_CHECKOUT": "master", + "SFCGAL_CHECKOUT_SHA1": "nocheck", + "PROJ_CHECKOUT": "master", + "PROJ_CHECKOUT_SHA1": "nocheck", + "GDAL_BUILD": "with_extra", + "GDAL_CHECKOUT": "master", + "GDAL_CHECKOUT_SHA1": "nocheck", + "GEOS_CHECKOUT": "main", + "GEOS_CHECKOUT_SHA1": "nocheck", + "BOOST_VERSION": "1.74.0" + } + }, + "17-recent": { + "bookworm": { + "tags": "17-recent-bookworm 17-recent-postgis3.5.0-geos3.13.0-proj9.5.0-gdal3.10.0-cgal6.0.1-sfcgal2.0.0-bookworm 17-recent-postgis3.5-geos3.13-proj9.5-gdal3.10-cgal6.0-sfcgal2.0-bookworm 17-recent recent", + "postgis": "recent", + "readme_group": "recent", + "PG_MAJOR": "17", + "PG_DOCKER": "17", + "arch": "amd64 arm64", + "template": "Dockerfile.master.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_CHECKOUT": "tags/3.5.0", + "POSTGIS_CHECKOUT_SHA1": "d2c3ca48e648571deda98d8e4d9bb4e2c82fde16", + "PROJ_CHECKOUT": "tags/9.5.0", + "PROJ_CHECKOUT_SHA1": "0a407325fbb5bf42407a7dc5d4f948be9707e302", + "GDAL_BUILD": "with_extra", + "GDAL_CHECKOUT": "tags/v3.10.0", + "GDAL_CHECKOUT_SHA1": "35a44cc570cdf4dbd55611e4bd61da76e56bc221", + "GEOS_CHECKOUT": "tags/3.13.0", + "GEOS_CHECKOUT_SHA1": "d7957246c588aa9c690efe67924fd70e741a06ab", + "SFCGAL_CHECKOUT": "tags/v2.0.0", + "SFCGAL_CHECKOUT_SHA1": "5d4eb5e896c41e592534ba1e79ccc721c66d66e3", + "CGAL_CHECKOUT": "tags/v6.0.1", + "CGAL_CHECKOUT_SHA1": "50cfbde3b84dbeae8338268db2d78fe4fcb522de", + "BOOST_VERSION": "1.74.0" + } + }, + "14-l3.1.9gcp": { + "bookworm": { + "_comment": "source: ./locked.yml", + "tags": "14-l3.1.9gcp-bookworm 14-l3.1.9gcp-postgis3.1.9-geos3.6.6-proj6.3.1-bookworm", + "postgis": "l3.1.9gcp", + "readme_group": "locked", + "PG_MAJOR": "14", + "PG_DOCKER": "14", + "arch": "amd64 arm64", + "template": "Dockerfile.master.template", + "initfile": "initdb-postgis.sh", + "POSTGIS_CHECKOUT": "tags/3.1.9", + "POSTGIS_CHECKOUT_SHA1": "95a641b1747721d7004c5f0133b918d034035319", + "PROJ_CHECKOUT": "tags/6.3.1", + "PROJ_CHECKOUT_SHA1": "0e993d9744ecaa2f146bf62c43aecc61809a43ef", + "GDAL_BUILD": "minimal", + "GDAL_CHECKOUT": "tags/v3.6.4", + "GDAL_CHECKOUT_SHA1": "7ca88116f5a46d429251361634eb24629f315076", + "GEOS_CHECKOUT": "tags/3.6.6", + "GEOS_CHECKOUT_SHA1": "36ea3034fb8719a639a7e7727e54ec8ab2e8a196", + "SFCGAL_CHECKOUT": "tags/v1.5.1", + "SFCGAL_CHECKOUT_SHA1": "61f3b08ade49493b56c6bafa98c7c1f84addbc10", + "CGAL_CHECKOUT": "tags/v5.6", + "CGAL_CHECKOUT_SHA1": "de4fa0d7d57b5a997012f2804161386ff4bc0d0f", + "BOOST_VERSION": "1.74.0" + } + } +} diff --git a/versions.sh b/versions.sh new file mode 100755 index 00000000..849ed546 --- /dev/null +++ b/versions.sh @@ -0,0 +1,780 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -Eeuo pipefail + +# Source environment variables and necessary configurations +source tools/environment_init.sh + +# This code derived from: +# - URL: https://github.com/docker-library/postgres/blob/master/versions.sh +# - Copyright: (c) Docker PostgreSQL Authors +# - MIT License, https://github.com/docker-library/postgres/blob/master/LICENSE + +# --debug +# set -xv ; exec 1> >(tee "./update.log") 2>&1 + +# ---------- Setups --------- +api_preference="github" +#api_preference="osgeo" -- not working yet + +alpine_variants=" alpine3.19 alpine3.20 " +debian_variants=" bullseye bookworm " + +debian_latest="bookworm" +alpine_latest="alpine3.20" +postgis_latest="3.5" +postgres_latest="17" +postgis_versions="3.0 3.1 3.2 3.3 3.4 3.5" +postgres_versions="11 12 13 14 15 16 17" + +# MASTER_BRANCH_MODE='flexible'=if you want to use the latest version of the dependencies - automatically +# if not set, it will use the locked version, and the checkout hash will be used +MASTER_BRANCH_MODE="flexible" + +POSTGIS_BRANCH="master" +GEOS_BRANCH="main" +GDAL_BRANCH="master" +PROJ_BRANCH="master" +SFCGAL_BRANCH="master" +CGAL_BRANCH="master" + +# locked: extra locking versions for dependencies +CGAL_CHECKOUT_LOCK="" +SFCGAL_CHECKOUT_LOCK="" +GEOS_CHECKOUT_LOCK="" +PROJ_CHECKOUT_LOCK="" +GDAL_CHECKOUT_LOCK="" + +declare -A postgisDebPkgNameVersionSuffixes=( + [3.0]='3' + [3.1]='3' + [3.2]='3' + [3.3]='3' + [3.4]='3' + [3.5]='3' + [3.6]='3' +) + +declare -A boostVersion=( + ["bullseye"]="1.74.0" + ["bookworm"]="1.74.0" # 1.81.0 is not yet optimal. The current bookworm packages mixed use of 1.74.0 and 1.81.0 + ["alpine3.19"]="1.82.0" + ["alpine3.20"]="1.82.0" +) + +# function get_tag_hash() { +# hash_value=$(get_tag_hash "https://github.com/postgis/postgis.git" "3.4.0") +# echo $hash_value +function get_tag_hash() { + local repo="$1" + local version="$2" + + # remove tag/ prefix if exists. + version=${version#tags/} + + git ls-remote --sort="v:refname" "$repo" refs/tags/"$version"* | + grep -E 'refs/tags/'"$version"'(\^\{\})?$' | + tail -n1 | + awk '{print $1}' +} + +# extracts a version number and limits it to up to two segments (digits separated by dots). +function extract_version_up_to_two_digits() { + local input_version=$1 + if [[ $input_version =~ ^([0-9]+(\.[0-9]+)?) ]]; then + echo "${BASH_REMATCH[1]}" + else + echo "" + fi +} + +# Convert YAML input to pretty-printed JSON format. +function yaml2json_pretty { + python3 -c 'import sys, yaml, json; print(json.dumps(yaml.safe_load(sys.stdin.read()), indent=2, sort_keys=False))' +} + +# Correct version sorting +function version_reverse_sort() { + # This function sorts version numbers in reverse order, + # ensuring that versions without pre-release tags (e.g., "3.4.0") + # are ranked higher than those with pre-release tags (e.g., "3.4.0rc4"). + # It adds a ".9991" suffix to versions without pre-release tags, + # sorts them with `sort -Vr`, and then removes the ".9991" suffix. + sed -r "s/([0-9]+\.[0-9]+\.[0-9]+$)/\1\.9991/" | sort -Vr | sed s/\.9991$// +} + +# fetch available postgres docker versions from the docker hub +function fetch_postgres_docker_versions() { + + echo " " + echo "Fetching available PostgreSQL Docker image versions from Docker Hub. ( https://registry.hub.docker.com )" + + local PAGE_SIZE=100 + local page=1 + postgres_all_docker_versions="" + while true; do + local response + response=$(curl --silent "https://registry.hub.docker.com/v2/repositories/library/postgres/tags?page=${page}&page_size=${PAGE_SIZE}") || { + echo "Failed to fetch from registry.hub.docker.com" + return 1 + } + + # Extract tag names from the JSON response + local tags + tags=$(echo "$response" | grep -Po '"name":\s*"\K[^"]+' || true) + local count + count=$(echo "$tags" | sed '/^$/d' | wc -l) + if ((count == 0)); then + break + fi + if ((page > 40)); then + echo "(docker api) Too many pages: ${page} - exiting; unexpected and something is wrong!" + exit 1 + fi + postgres_all_docker_versions+=$'\n'"$tags" + ((page++)) + done +} + +fetch_postgres_docker_versions || { + echo "Error fetching Docker postgres versions! Maybe network or server error!" + exit 1 +} + +# Postgres versions , keep only 1* versions; +postgres_all_docker_versions=$(echo "$postgres_all_docker_versions" | grep '^1' | cut -d'-' -f1 | sort -u | version_reverse_sort) +postgres_all_docker_versions_string=$(echo "$postgres_all_docker_versions" | tr '\n' ' ') +echo "postgres_all_docker_versions_string = ${postgres_all_docker_versions_string}" +echo " " + +declare -A postgresLastTags=() +declare -A postgresLastMainTags=() +for variant in ${postgres_versions}; do + postgresLastTags[$variant]=$(echo "$postgres_all_docker_versions" | grep "^${variant}" | version_reverse_sort | head -n 1 || true) + postgresLastMainTags[$variant]=$(echo "${postgresLastTags[$variant]}" | cut -d'.' -f1) + echo "postgresLastTags[$variant] = ${postgresLastTags[$variant]}" + echo "postgresLastMainTags[$variant] = ${postgresLastMainTags[$variant]}" +done +echo " " + +# Check if the github api is limited <= 8 requests; if so, do not continue +if [ "$api_preference" == "github" ]; then + rateLimitRemaining=$(curl -iks https://api.github.com/users/postgis 2>&1 | grep -im1 'X-Ratelimit-Remaining:' | grep -o '[[:digit:]]*') + echo "github rateLimitRemaining = ${rateLimitRemaining}" + echo " " + if [ "${rateLimitRemaining}" -le 8 ]; then + echo + echo " You do not have enough github requests available to continue!" + echo + echo " Without logging - the github api is limited to 60 requests per hour" + echo " see: https://developer.github.com/v3/#rate-limiting " + echo " You can check your remaining requests with :" + echo " curl -sI https://api.github.com/users/postgis | grep x-ratelimit " + echo + echo " ------------------------ " + curl -sI https://api.github.com/users/postgis | grep x-ratelimit + echo + echo " The limit will be reset at :" + curl -sI https://api.github.com/users/postgis | grep x-ratelimit-reset | cut -d' ' -f2 | xargs -I {} date -d @{} + exit 1 + fi +fi + +packagesBase='http://apt.postgresql.org/pub/repos/apt/dists/' +cgal5XGitHash="$(git ls-remote https://github.com/CGAL/cgal.git heads/5.6.x-branch | awk '{ print $1}')" +sfcgalGitHash="$(git ls-remote https://gitlab.com/sfcgal/SFCGAL.git heads/master | awk '{ print $1}')" +projGitHash="$(git ls-remote https://github.com/OSGeo/PROJ.git heads/master | awk '{ print $1}')" +gdalGitHash="$(git ls-remote https://github.com/OSGeo/gdal.git refs/heads/master | grep '\srefs/heads/master' | awk '{ print $1}')" +geosGitHash="$(git ls-remote https://github.com/libgeos/geos.git heads/main | awk '{ print $1}')" +postgisGitHash="$(git ls-remote https://github.com/postgis/postgis.git heads/master | awk '{ print $1}')" + +# Function to get the latest version tag and its SHA1 hash +get_latest_version_and_hash() { + # Argument 1: Repository URL + local repo_url="$1" + # Argument 2: Repository identifier + local repo_id="$2" + # development version .. witj --pre + local repo_development="${3:-}" + # Argumnet 3: tag filter - optional + local repo_only="${4:-}" + # Argumnet 4: checkout lock + local checkout_lock="${5:-}" + + # remove tag/ prefix if exists. + checkout_lock=${checkout_lock#tags/} + + echo "[+] Checking lastversion : $repo_id - $repo_url" + # Fetch the latest version tag using the lastversion command + + if [[ "${repo_development}" == "pre-releases" ]]; then + repo_development="--pre" + else + repo_development="" + fi + + if [[ "${repo_only}" == "norepo" ]]; then + repo_only="" + fi + + if [ -z "$checkout_lock" ]; then + if [ -z "$repo_only" ]; then + eval "lastversion_${repo_id}=$(lastversion ${repo_development} --format tag "${repo_url}")" + else + eval "lastversion_${repo_id}${repo_only}=$(lastversion ${repo_development} --format tag --only "${repo_only}" "${repo_url}")" + fi + else + echo " !Locked to ${checkout_lock}" + if [ -z "$repo_only" ]; then + eval "lastversion_${repo_id}=${checkout_lock}" + else + eval "lastversion_${repo_id}${repo_only}=${checkout_lock}" + fi + fi + + # Intermediary step to resolve the variable name + local var_name="lastversion_${repo_id}${repo_only}" + local last_version=${!var_name} + + # Fetch the SHA1 hash of the tag using the get_tag_hash function + eval "lastversion_${repo_id}${repo_only}_sha1=$(get_tag_hash "${repo_url}" "${last_version}")" + + #creating new variables for using later .. + echo " lastversion_${repo_id}${repo_only} = ${last_version}" + + local sha1_var_name="lastversion_${repo_id}${repo_only}_sha1" + local sha1_value=${!sha1_var_name} + echo " lastversion_${repo_id}${repo_only}_sha1 = ${sha1_value}" + echo " " + + if [ -z "$last_version" ]; then + echo "[-] Error: could not get the latest version tag! Stopping!" + exit 1 + fi + + if [ -z "$sha1_value" ]; then + echo "[-] Error: could not get the SHA1 hash for the latest version tag! Stopping!" + exit 1 + fi +} + +get_latest_version_and_hash "https://github.com/MobilityDB/MobilityDB" "mobilitydb" releases norepo "" +get_latest_version_and_hash "https://github.com/pramsey/pgsql-http" "pgsql_http" releases norepo "" +get_latest_version_and_hash "https://github.com/pramsey/pgsql-gzip" "pgsql_gzip" releases norepo "" +get_latest_version_and_hash "https://github.com/timescale/timescaledb" "timescaledb" releases norepo "" +get_latest_version_and_hash "https://github.com/duckdb/duckdb" "duckdb" releases norepo "" + +get_latest_version_and_hash "https://github.com/postgis/postgis" "postgis" releases norepo "" +get_latest_version_and_hash "https://github.com/CGAL/cgal" "cgal" releases norepo "${CGAL_CHECKOUT_LOCK}" +get_latest_version_and_hash "https://github.com/libgeos/geos" "geos" releases norepo "${GEOS_CHECKOUT_LOCK}" +get_latest_version_and_hash "https://github.com/OSGeo/gdal" "gdal" releases norepo "${GDAL_CHECKOUT_LOCK}" +get_latest_version_and_hash "https://github.com/OSGeo/PROJ" "proj" releases norepo "${PROJ_CHECKOUT_LOCK}" +get_latest_version_and_hash "https://gitlab.com/sfcgal/SFCGAL" "sfcgal" releases norepo "${SFCGAL_CHECKOUT_LOCK}" + +get_latest_version_and_hash "https://github.com/ossc-db/pg_hint_plan" "pg_hint_plan" releases REL17 "" +get_latest_version_and_hash "https://github.com/ossc-db/pg_hint_plan" "pg_hint_plan" releases REL16 "" +get_latest_version_and_hash "https://github.com/ossc-db/pg_hint_plan" "pg_hint_plan" releases REL15 "" +get_latest_version_and_hash "https://github.com/ossc-db/pg_hint_plan" "pg_hint_plan" releases REL14 "" +get_latest_version_and_hash "https://github.com/ossc-db/pg_hint_plan" "pg_hint_plan" releases REL13 "" + +#------------------------------------------- + +function fetch_postgis_versions() { + # get all postgis versions from github + local REPO="postgis/postgis" + local PER_PAGE=100 # You can ask for up to 100 results per page + local page=1 + postgis_all_v3_versions="" + + while true; do + local response + if [ "$api_preference" == "github" ]; then + response=$(curl --silent "https://api.github.com/repos/$REPO/tags?per_page=$PER_PAGE&page=$page") || { + echo "Failed to fetch postgis_versions from api.github.com/repos/$REPO/tags" + return 1 + } + elif [ "$api_preference" == "osgeo" ]; then + response=$(curl --silent "https://git.osgeo.org/gitea/api/v1/repos/${REPO}/tags?page=$page&limit=$PER_PAGE") || { + echo "Failed to fetch postgis_versions from git.osgeo.org/gitea/api/v1/repos/${REPO}/tags" + return 1 + } + fi + + # Check for rate limit exceeded error - related to api.github.com + if echo "$response" | grep -q "API rate limit exceeded"; then + echo "Error: API rate limit exceeded!" + echo "$response" + exit 1 + fi + + # Extract tag names from the JSON response + local tags + tags=$(echo "$response" | grep -Po '"name":\s*"\K[^"]+' || true) + local count + count=$(echo "$tags" | sed '/^$/d' | wc -l) + + if ((count == 0)); then + break + fi + + if ((page > 12)); then + echo "Too many pages: ${page} - exiting; unexpected and something is wrong!" + exit 1 + fi + + postgis_all_v3_versions+=" $tags" + + ((page++)) + done +} + +fetch_postgis_versions || { + echo "Error fetching postgis versions! Maybe network or server error!" + exit 1 +} + +# Keep 3.* versions only +postgis_all_v3_versions=$(echo "$postgis_all_v3_versions" | sed '/^$/d' | grep '^3\.' | version_reverse_sort) +postgis_all_v3_versions_array_string=$(echo "$postgis_all_v3_versions" | tr '\n' ' ') +echo "postgis_all_v3_versions_array_string = ${postgis_all_v3_versions_array_string}" +echo " " + +declare -A postgisLastTags=() +declare -A postgisLastDockerTags=() +declare -A postgisSrcSha256=() +declare -A postgisSrcSha1=() +for variant in ${postgis_versions}; do + _postgisMinor=$(echo "$variant" | cut -d. -f2) + + # check the latest released 3.x version (so not alpha/beta/rc) + postgisLastTags[$variant]=$(echo "$postgis_all_v3_versions" | grep "^3\.${_postgisMinor}\." | grep -v '[a-zA-Z]' | version_reverse_sort | head -n 1 || true) + # Check if the result is empty + if [[ -z "${postgisLastTags[$variant]}" ]]; then + # If empty, run the command again without excluding pre-releases (alpha/beta/rc) + postgisLastTags[$variant]=$(echo "$postgis_all_v3_versions" | grep "^3\.${_postgisMinor}\." | version_reverse_sort | head -n 1 || true) + fi + + if [[ ${postgisLastTags[$variant]} =~ [a-zA-Z] ]]; then + postgisLastDockerTags[$variant]=${postgisLastTags[$variant]} + else + postgisLastDockerTags[$variant]=$(echo "${postgisLastTags[$variant]}" | cut -d'.' -f1,2) + fi + echo "postgisLastDockerTags[$variant] = ${postgisLastDockerTags[$variant]}" + echo "postgisLastTags[$variant] = ${postgisLastTags[$variant]}" + + if [ "${postgisLastTags[$variant]}" == "" ]; then + postgisSrcSha256[$variant]="" + postgisSrcSha1[$variant]="" + else + if [ "$api_preference" == "github" ]; then + postgisSrcSha256[$variant]="$(curl -sSL "https://github.com/postgis/postgis/archive/${postgisLastTags[$variant]}.tar.gz" | sha256sum | awk '{ print $1 }')" + postgisSrcSha1[$variant]=$(get_tag_hash https://github.com/postgis/postgis.git "${postgisLastTags[$variant]}") + elif [ "$api_preference" == "osgeo" ]; then + postgisSrcSha256[$variant]="$(curl -sSL "https://git.osgeo.org/gitea/postgis/postgis/archive/${postgisLastTags[$variant]}.tar.gz" | sha256sum | awk '{ print $1 }')" + fi + fi + echo "postgisSrcSha256[$variant]=${postgisSrcSha256[$variant]}" + echo "postgisSrcSha1[$variant]=${postgisSrcSha1[$variant]}" +done + +cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +versions=("$@") +if [ ${#versions[@]} -eq 0 ]; then + versions=() + for variant in $alpine_variants $debian_variants; do + for path in */"${variant}"/Dockerfile; do + if [[ -f $path ]]; then + versions+=("$path") + fi + done + done + mapfile -t versions < <(printf '%s\n' "${versions[@]}" | cut -d'/' -f1 | sort -u -V) +fi + +echo " " +echo "versions= ${versions[*]}" + +declare -A suitePackageList=() +declare -A suiteArches=() +declare -A fullVersion=() +declare -A debianPostgisMajMin=() +declare -A postgisMajMin=() +declare -A postgisPackageName=() +declare -A postgisFullVersion=() +declare -A postgisMajor=() +declare -A postgisDocSrc=() + +rm -f _versions.yml + +for version in "${versions[@]}"; do + IFS=- read -r postgresVersion postgisVersion bundleType <<<"$version" + + echo " " + echo "---- generate Dockerfile for $version ----" + echo "postgresVersion=$postgresVersion" + echo "postgisVersion=$postgisVersion" + echo "bundleType=$bundleType" + if [ -z "$bundleType" ]; then + echo " ---> bundleType is empty" + else + echo " ---> bundleType is $bundleType" + fi + echo " " + + # if the first letter of "postgisVersion" is "l" then + # the version is locked and we use the definition from locked.yml + if [[ "${postgisVersion:0:1}" == "l" ]]; then + echo " ---> locked ; definition from locked.yml !" + continue + fi + + if [[ "master" == "$postgisVersion" || "recent" == "$postgisVersion" ]]; then + srcVersion="" + srcSha256="" + srcSha1="" + else + if [[ -v "postgisLastTags[${postgisVersion}]" ]]; then + echo ":: postgisLastTags[${postgisVersion}] exists in the array." + srcVersion="${postgisLastTags[${postgisVersion}]}" + srcSha256="${postgisSrcSha256[${postgisVersion}]}" + srcSha1="${postgisSrcSha1[${postgisVersion}]}" + elif [[ " $postgis_all_v3_versions_array_string " == *" $postgisVersion "* ]]; then + echo "!!!! ${postgisVersion} exists in postgis_all_v3_versions_array_string." + srcVersion=${postgisVersion} + srcSha256="$(curl -sSL "https://github.com/postgis/postgis/archive/${postgisVersion}.tar.gz" | sha256sum | awk '{ print $1 }')" + srcSha1=$(git ls-remote https://github.com/postgis/postgis.git refs/tags/"${postgisVersion}" | awk '{print $1}') + #srcSha256="$(curl -sSL "https://git.osgeo.org/gitea/postgis/postgis/archive/${postgisVersion}.tar.gz" | sha256sum | awk '{ print $1 }')" + else + echo "Unknown $postgisVersion version, please check the postgis_all_v3_versions array!" + exit 1 + fi + fi + echo srcVersion="$srcVersion" + echo srcSha256="$srcSha256" + echo srcSha1="$srcSha1" + + # Check current status of postgis debian packages + for suite in $debian_variants; do + if [ -z "${suitePackageList["$suite"]:+isset}" ]; then + suitePackageList["$suite"]="$(curl -fsSL "${packagesBase}/${suite}-pgdg/main/binary-amd64/Packages.bz2" | bunzip2)" + fi + if [ -z "${suiteArches["$suite"]:+isset}" ]; then + suiteArches["$suite"]="$(curl -fsSL "${packagesBase}/${suite}-pgdg/Release" | awk -F ':[[:space:]]+' '$1 == "Architectures" { gsub(/[[:space:]]+/, "|", $2); print $2 }')" + echo "suiteArches[$suite] = ${suiteArches[$suite]}" + fi + + postgresVersionMain="$(echo "$postgresVersion" | awk -F 'alpha|beta|rc' '{print $1}')" + versionList="$( + echo "${suitePackageList["$suite"]}" + curl -fsSL "${packagesBase}/${suite}-pgdg/${postgresVersionMain}/binary-amd64/Packages.bz2" | bunzip2 + )" + fullVersion["$suite"]="$(echo "$versionList" | awk -F ': ' '$1 == "Package" { pkg = $2 } $1 == "Version" && pkg == "postgresql-'"$postgresVersionMain"'" { print $2; exit }' || true)" + echo "fullVersion[$suite] = ${fullVersion[$suite]}" + + debianPostgisMajMin["$suite"]="" + if [ "master" == "$postgisVersion" ]; then + debianPostgisMajMin["$suite"]="" + postgisPackageName["$suite"]="" + postgisFullVersion["$suite"]="$postgisVersion" + postgisMajor["$suite"]="" + postgisDocSrc["$suite"]="development: postgis, geos, proj, gdal" + elif [ "recent" == "$postgisVersion" ]; then + #TODO + debianPostgisMajMin["$suite"]="" + postgisPackageName["$suite"]="" + postgisFullVersion["$suite"]="$postgisVersion" + postgisMajor["$suite"]="" + postgisDocSrc["$suite"]="... recent ... " + else + postgisMajMin["$suite"]="$(echo "${postgisVersion}" | cut -d. -f1).$(echo "${postgisVersion}" | cut -d. -f2)" + echo "postgisMajMin[$suite]= ${postgisMajMin[${suite}]}" + + postgisPackageName["$suite"]="postgresql-${postgresVersionMain}-postgis-${postgisDebPkgNameVersionSuffixes[${postgisMajMin[${suite}]}]}" + postgisFullVersion["$suite"]="$(echo "$versionList" | awk -F ': ' '$1 == "Package" { pkg = $2 } $1 == "Version" && pkg == "'"${postgisPackageName[${suite}]}"'" { print $2; exit }' || true)" + echo "postgisPackageName[$suite]= ${postgisPackageName[$suite]}" + echo "postgisFullVersion[$suite]= ${postgisFullVersion[$suite]}" + + debianPostgisMajMin["$suite"]="$(echo "${postgisFullVersion["$suite"]}" | cut -d. -f1).$(echo "${postgisFullVersion["$suite"]}" | cut -d. -f2)" + + if [ "${debianPostgisMajMin[${suite}]}" == "${postgisMajMin[${suite}]}" ]; then + echo "debian[$suite] : postgis version is OK !" + postgisMajor["$suite"]="${postgisDebPkgNameVersionSuffixes[${postgisMajMin[${suite}]}]}" + postgisDocSrc["$suite"]="${postgisFullVersion[${suite}]%%+*}" + else + echo "debian[$suite] : postgis is not updated, different ! " + postgisFullVersion["$suite"]="" + postgisMajor["$suite"]="" + postgisDocSrc["$suite"]="" + fi + fi + done + + printf "'%s':\n" "$version" >>_versions.yml + #generate debian versions + for variant in $debian_variants; do + if [ -d "$version/$variant" ] && [[ "${postgisDocSrc[$variant]}" == "" ]]; then + ( + echo " " + echo "$version/$variant - debian[$variant] : postgis is not updated/exists - skip and clean the directory! " + # remove all files in the directory ! + rm -rf "${version:?}/${variant:?}/*" + ) + elif [ -d "$version/$variant" ]; then + ( + echo " " + echo "---- $version/$variant --- " + + if [[ "master" == "$postgisVersion" ]]; then + postgisDockerTag="master" + elif [[ "recent" == "$postgisVersion" ]]; then + postgisDockerTag="recent" + else + postgisDockerTag="${postgisLastDockerTags[$postgisVersion]}" + fi + + bundleTypeTags="" + mainTags="${postgresLastMainTags[$postgresVersion]}-${postgisDockerTag}" + if [ -n "$bundleType" ]; then + readme_group="$bundleType" + bundleTypeTags="-${bundleType}" + elif [[ ${postgresLastMainTags[$postgresVersion]} =~ ^[0-9]+$ ]] && [[ "$postgisVersion" == "recent" ]]; then + readme_group="recent" + elif [[ ${mainTags} =~ [a-zA-Z] ]]; then + readme_group="test" + else + readme_group=$variant + fi + + tags="${mainTags}${bundleTypeTags}-${variant}" + if [[ "recent" == "$postgisVersion" ]]; then + lastversion_postgis_tag=${lastversion_postgis#tags/} + lastversion_postgis_tag=${lastversion_postgis_tag#v} + lastversion_proj_tag=${lastversion_proj#tags/} + lastversion_proj_tag=${lastversion_proj_tag#v} + lastversion_geos_tag=${lastversion_geos#tags/} + lastversion_geos_tag=${lastversion_geos_tag#v} + lastversion_gdal_tag=${lastversion_gdal#tags/} + lastversion_gdal_tag=${lastversion_gdal_tag#v} + lastversion_cgal_tag=${lastversion_cgal#tags/} + lastversion_cgal_tag=${lastversion_cgal_tag#v} + lastversion_sfcgal_tag=${lastversion_sfcgal#tags/} + lastversion_sfcgal_tag=${lastversion_sfcgal_tag#v} + + tags+=" ${mainTags}-postgis${lastversion_postgis_tag}-geos${lastversion_geos_tag}-proj${lastversion_proj_tag}-gdal${lastversion_gdal_tag}-cgal${lastversion_cgal_tag}-sfcgal${lastversion_sfcgal_tag}-${variant}" + + lastversion_postgis_tag2d=$(extract_version_up_to_two_digits "$lastversion_postgis_tag") + lastversion_proj_tag2d=$(extract_version_up_to_two_digits "$lastversion_proj_tag") + lastversion_geos_tag2d=$(extract_version_up_to_two_digits "$lastversion_geos_tag") + lastversion_gdal_tag2d=$(extract_version_up_to_two_digits "$lastversion_gdal_tag") + lastversion_cgal_tag2d=$(extract_version_up_to_two_digits "$lastversion_cgal_tag") + lastversion_sfcgal_tag2d=$(extract_version_up_to_two_digits "$lastversion_sfcgal_tag") + + tags+=" ${mainTags}-postgis${lastversion_postgis_tag2d}-geos${lastversion_geos_tag2d}-proj${lastversion_proj_tag2d}-gdal${lastversion_gdal_tag2d}-cgal${lastversion_cgal_tag2d}-sfcgal${lastversion_sfcgal_tag2d}-${variant}" + fi + + if [[ "master" != "$postgisVersion" && "recent" != "$postgisVersion" && "${postgisDocSrc[$variant]}" != "${postgisDockerTag}" ]]; then + tags+=" ${postgresLastMainTags[$postgresVersion]}-${postgisDocSrc[$variant]}${bundleTypeTags}-${variant}" + fi + if [[ "$variant" == "$debian_latest" ]]; then + tags+=" ${postgresLastMainTags[$postgresVersion]}-${postgisDockerTag}${bundleTypeTags}" + if [[ "${postgis_latest}" == "${postgisDockerTag}" && "${postgres_latest}" == "${postgresLastMainTags[$postgresVersion]}" ]]; then + if [ -n "$bundleType" ]; then + tags+=" $bundleType" + else + tags+=" latest" + fi + elif [[ "recent" == "${postgisDockerTag}" && "${postgres_latest}" == "${postgresLastMainTags[$postgresVersion]}" ]]; then + tags+=" recent" + fi + fi + + { + printf " '%s':\n" "$variant" + printf " tags: '%s'\n" "$tags" + printf " postgis: '%s'\n" "${postgisDockerTag}" + printf " readme_group: '%s'\n" "$readme_group" + printf " PG_MAJOR: '%s'\n" "$postgresVersion" + printf " PG_DOCKER: '%s'\n" "${postgresLastMainTags[$postgresVersion]}" + } >>_versions.yml + + if [[ "master" == "$postgisVersion" ]]; then + { + printf " arch: '%s'\n" "amd64 arm64" + printf " template: '%s'\n" "Dockerfile.master.template" + printf " initfile: '%s'\n" "initdb-postgis.sh" + + if [[ "$MASTER_BRANCH_MODE" == "flexible" ]]; then + printf " POSTGIS_CHECKOUT: '%s'\n" "$POSTGIS_BRANCH" + printf " POSTGIS_CHECKOUT_SHA1: 'nocheck'\n" + printf " CGAL_CHECKOUT: '%s'\n" "$CGAL_BRANCH" + printf " CGAL_CHECKOUT_SHA1: 'nocheck'\n" + printf " SFCGAL_CHECKOUT: '%s'\n" "$SFCGAL_BRANCH" + printf " SFCGAL_CHECKOUT_SHA1: 'nocheck'\n" + printf " PROJ_CHECKOUT: '%s'\n" "$PROJ_BRANCH" + printf " PROJ_CHECKOUT_SHA1: 'nocheck'\n" + printf " GDAL_BUILD: '%s'\n" "with_extra" + printf " GDAL_CHECKOUT: '%s'\n" "$GDAL_BRANCH" + printf " GDAL_CHECKOUT_SHA1: 'nocheck'\n" + printf " GEOS_CHECKOUT: '%s'\n" "$GEOS_BRANCH" + printf " GEOS_CHECKOUT_SHA1: 'nocheck'\n" + else + printf " POSTGIS_CHECKOUT: '%s'\n" "$postgisGitHash" + printf " POSTGIS_CHECKOUT_SHA1: '%s'\n" "$postgisGitHash" + printf " CGAL_CHECKOUT: '%s'\n" "$cgal5XGitHash" + printf " CGAL_CHECKOUT_SHA1: '%s'\n" "$cgal5XGitHash" + printf " SFCGAL_CHECKOUT: '%s'\n" "$sfcgalGitHash" + printf " SFCGAL_CHECKOUT_SHA1: '%s'\n" "$sfcgalGitHash" + printf " PROJ_CHECKOUT: '%s'\n" "$projGitHash" + printf " PROJ_CHECKOUT_SHA1: '%s'\n" "$projGitHash" + printf " GDAL_BUILD: '%s'\n" "with_extra" + printf " GDAL_CHECKOUT: '%s'\n" "$gdalGitHash" + printf " GDAL_CHECKOUT_SHA1: '%s'\n" "$gdalGitHash" + printf " GEOS_CHECKOUT: '%s'\n" "$geosGitHash" + printf " GEOS_CHECKOUT_SHA1: '%s'\n" "$geosGitHash" + fi + + printf " BOOST_VERSION: '%s'\n" "${boostVersion[$variant]}" + } >>_versions.yml + + elif [[ "recent" == "$postgisVersion" ]]; then + { + printf " arch: '%s'\n" "amd64 arm64" + printf " template: '%s'\n" "Dockerfile.master.template" + printf " initfile: '%s'\n" "initdb-postgis.sh" + + printf " POSTGIS_CHECKOUT: 'tags/%s'\n" "$lastversion_postgis" + printf " POSTGIS_CHECKOUT_SHA1: '%s'\n" "$lastversion_postgis_sha1" + printf " PROJ_CHECKOUT: 'tags/%s'\n" "$lastversion_proj" + printf " PROJ_CHECKOUT_SHA1: '%s'\n" "$lastversion_proj_sha1" + printf " GDAL_BUILD: '%s'\n" "with_extra" + printf " GDAL_CHECKOUT: 'tags/%s'\n" "$lastversion_gdal" + printf " GDAL_CHECKOUT_SHA1: '%s'\n" "$lastversion_gdal_sha1" + printf " GEOS_CHECKOUT: 'tags/%s'\n" "$lastversion_geos" + printf " GEOS_CHECKOUT_SHA1: '%s'\n" "$lastversion_geos_sha1" + printf " SFCGAL_CHECKOUT: 'tags/%s'\n" "$lastversion_sfcgal" + printf " SFCGAL_CHECKOUT_SHA1: '%s'\n" "$lastversion_sfcgal_sha1" + printf " CGAL_CHECKOUT: 'tags/%s'\n" "$lastversion_cgal" + printf " CGAL_CHECKOUT_SHA1: '%s'\n" "$lastversion_cgal_sha1" + + printf " BOOST_VERSION: '%s'\n" "${boostVersion[$variant]}" + } >>_versions.yml + + else + { + if [[ "$variant" == "$debian_latest" ]]; then + # generating amd64 and arm64 only for latest debian + printf " arch: '%s'\n" "amd64 arm64" + else + printf " arch: '%s'\n" "amd64 arm64" + fi + + if [ -z "$bundleType" ]; then + printf " template: '%s'\n" "Dockerfile.debian.template" + printf " initfile: '%s'\n" "initdb-postgis.sh" + else + printf " template: '%s'\n" "Dockerfile.${bundleType}.template" + printf " initfile: '%s'\n" "initdb-${bundleType}.sh" + + printf " MOBILITYDB_CHECKOUT: 'tags/%s'\n" "$lastversion_mobilitydb" + printf " MOBILITYDB_CHECKOUT_SHA1: '%s'\n" "$lastversion_mobilitydb_sha1" + + printf " PGSQL_HTTP_CHECKOUT: 'tags/%s'\n" "$lastversion_pgsql_http" + printf " PGSQL_HTTP_CHECKOUT_SHA1: '%s'\n" "$lastversion_pgsql_http_sha1" + + printf " PGSQL_GZIP_CHECKOUT: 'tags/%s'\n" "$lastversion_pgsql_gzip" + printf " PGSQL_GZIP_CHECKOUT_SHA1: '%s'\n" "$lastversion_pgsql_gzip_sha1" + + printf " TIMESCALEDB_CHECKOUT: 'tags/%s'\n" "$lastversion_timescaledb" + printf " TIMESCALEDB_CHECKOUT_SHA1: '%s'\n" "$lastversion_timescaledb_sha1" + + printf " DUCKDB_CHECKOUT: 'tags/%s'\n" "$lastversion_duckdb" + printf " DUCKDB_CHECKOUT_SHA1: '%s'\n" "$lastversion_duckdb_sha1" + + lastversion_pg_hint_plan="lastversion_pg_hint_planREL${postgresVersion}" + lastversion_pg_hint_plan_sha1="lastversion_pg_hint_planREL${postgresVersion}_sha1" + printf " PG_HINT_PLAN_CHECKOUT: 'tags/%s'\n" "${!lastversion_pg_hint_plan}" + printf " PG_HINT_PLAN_CHECKOUT_SHA1: '%s'\n" "${!lastversion_pg_hint_plan_sha1}" + + fi + + printf " POSTGIS_MAJOR: '%s'\n" "${postgisMajor[$variant]}" + printf " POSTGIS_VERSION: '%s'\n" "${postgisFullVersion[$variant]}" + } >>_versions.yml + fi + ) + fi + done + + # generate alpine versions + for variant in $alpine_variants; do + if [ -d "$version/$variant" ] && [[ "master" == "$postgisVersion" ]]; then + ( + echo " " + echo "$version/$variant - debian[$variant] : master is allowed only for $debian_latest ; Skip and clean the directory! " + # remove all files in the directory ! + rm -rf "${version:?}/${variant:?}/*" + ) + elif [ -d "$version/$variant" ]; then + ( + if [[ "master" == "$postgisVersion" || "$postgisVersion" == "recent" ]]; then + echo "Alpine - $postgisVersion is not supported! STOP!" + exit 1 + fi + + postgisDockerTag="${postgisLastDockerTags[$postgisVersion]}" + + echo "postgresVersion=${postgresVersion}" + mainTags="${postgresLastMainTags[$postgresVersion]}-${postgisLastDockerTags[$postgisVersion]}" + if [[ ${mainTags} =~ [a-zA-Z] ]]; then + readme_group="test" + else + readme_group=$variant + fi + tags="${mainTags}-${variant}" + + if [[ "master" != "$postgisVersion" && "$postgisVersion" != "recent" && "$srcVersion" != "${postgisLastDockerTags[$postgisVersion]}" ]]; then + tags+=" ${postgresLastMainTags[$postgresVersion]}-${srcVersion}-${variant}" + fi + if [[ "$variant" == "$alpine_latest" ]]; then + tags+=" ${postgresLastMainTags[$postgresVersion]}-${postgisLastDockerTags[$postgisVersion]}-alpine" + if [[ "${postgis_latest}" == "${postgisLastDockerTags[$postgisVersion]}" && "${postgres_latest}" == "${postgresLastMainTags[$postgresVersion]}" ]]; then + tags+=" alpine" + fi + fi + + { + printf " '%s':\n" "$variant" + printf " tags: '%s'\n" "$tags" + printf " readme_group: '%s'\n" "$readme_group" + printf " postgis: '%s'\n" "${postgisDockerTag}" + printf " arch: '%s'\n" "amd64 arm64" + printf " template: '%s'\n" "Dockerfile.alpine.template" + printf " initfile: '%s'\n" "initdb-postgis.sh" + printf " PG_MAJOR: '%s'\n" "$postgresVersion" + printf " PG_DOCKER: '%s'\n" "${postgresLastMainTags[$postgresVersion]}" + printf " POSTGIS_VERSION: '%s'\n" "$srcVersion" + printf " POSTGIS_SHA256: '%s'\n" "$srcSha256" + printf " POSTGIS_CHECKOUT: 'tags/%s'\n" "$srcVersion" + printf " POSTGIS_CHECKOUT_SHA1: '%s'\n" "$srcSha1" + } >>_versions.yml + + ) + fi + done +done + +# add locked configurations to _versions.yml file +cat locked.yml >>_versions.yml + +# convert yaml to json +yaml2json_pretty <./_versions.yml >./_versions.json + +# Remove any keys with null values from the JSON file. +# This is necessary when there are no variants for a specific version, resulting in a null key. +# Example: When the Debian PostGIS version is updated, and the this repo is not yet updated. +jq 'del(.[] | select(. == null))' ./_versions.json >./versions.json + +rm -f _versions.yml +rm -f _versions.json + +cat versions.json