diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml new file mode 100644 index 00000000..2eb07e3b --- /dev/null +++ b/.github/workflows/buildx.yml @@ -0,0 +1,154 @@ +name: buildx-experimental + +# This workflow is QEMU/BUILDX based! +# - Not for the platform='linux/amd64' see --> `main.yml' ! +# - Not for the `*-master``building. Emulation takes a lot of times! +# +# Expecting: upstream "postgres" docker images for OS/ARCH=platforms +# [ check https://hub.docker.com/_/postgres/tags ] +# +# Comments: ( with QEMU 7.0 / 2022-october ) +# 'linux/arm64' Postgres JIT is not working; ( SET JIT=OFF under the alpine test ; see alpine template ) +# 'linux/ppc64le' Postgres JIT is not working; ( SET JIT=OFF under the alpine test ; see alpine template ) +# 'linux/arm/v7' - debian: Unable to locate package postgresql-??-postgis-3; +# 'linux/arm/v6' - debian: Unable to locate package postgresql-??-postgis-3; +# 'linux/s390x' [alpine|debian] failed test. +# 'linux/mips64le' [alpine|debian] failed test. +# + +on: + push: + pull_request: + schedule: + - cron: '15 6 * * 1' + +defaults: + run: + shell: bash + +jobs: + + make-docker-images: + strategy: + # allowing fails .. + fail-fast: false + matrix: + # -3.3 debian for linux/arm64 + postgres: [11, 12, 13, 14, 15] + postgis: ['3.3'] + variant: [default] + platforms: ['linux/arm64'] + include: + - postgres: 10 + postgis: '3.2' + variant: default + platforms: 'linux/arm64' + + # 15-3.3-alpine for every platforms + - postgres: 15 + postgis: '3.3' + variant: 'alpine' + platforms: 'linux/arm64' + - postgres: 15 + postgis: '3.3' + variant: 'alpine' + platforms: 'linux/arm/v7' + - postgres: 15 + postgis: '3.3' + variant: 'alpine' + platforms: 'linux/arm/v6' + - postgres: 15 + postgis: '3.3' + variant: 'alpine' + platforms: 'linux/386' + - postgres: 15 + postgis: '3.3' + variant: 'alpine' + platforms: 'linux/ppc64le' + + # 15-3.3 debian for linux/ppc64le + - postgres: 15 + postgis: '3.3' + variant: 'default' + platforms: 'linux/ppc64le' + + name: ${{ matrix.platforms }} ${{ matrix.postgres }}-${{ matrix.postgis }} ${{ matrix.variant }} + runs-on: ubuntu-latest + + env: + # Alpine image version + ALPINE_VERSION: '3.16' + # Workflow name for internal logic; + # We are NOT the default ('main') workflow! + WORKFLOW: buildx + # Docker image Repo and Image name + REPO_NAME: postgis + IMAGE_NAME: postgis + # Docker image version and variant + VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }} + VARIANT: ${{ matrix.variant }} + # Docker image tag postfix + TAG_POSTFIX: '-experimental' + + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: "debug: docker buildx inspect --bootstrap" + run: docker buildx inspect --bootstrap + + - name: "debug: docker buildx ls" + run: docker buildx ls + + - name: "debug: Inspect the base alpine image postgres:${{ matrix.postgres }}-alpine${{ env.ALPINE_VERSION }} " + if: ${{ env.VARIANT == 'alpine' }} + run: docker pull postgres:${{ matrix.postgres }}-alpine${{ env.ALPINE_VERSION }} && docker inspect postgres:${{ matrix.postgres }}-alpine${{ env.ALPINE_VERSION }} + env: + DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }} + PLATFORM: ${{ matrix.platforms }} + + - name: "Build/Test: ${{ env.VERSION }} ${{ env.VARIANT }}${{env.TAG_POSTFIX}} ${{ env.DOCKER_DEFAULT_PLATFORM }}" + run: make test + env: + DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }} + PLATFORM: ${{ matrix.platforms }} + # Buildx/qemu test need more time + POSTGRES_TEST_TRIES: 42 + POSTGRES_TEST_SLEEP: 2 + + - name: "debug: docker images" + run: docker images + + - name: "debug: docker inspect ${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}${{ env.TAG_POSTFIX }}" + if: ${{ env.VARIANT == 'default' }} + run: docker inspect ${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}${{ env.TAG_POSTFIX }} + + - name: "debug: docker inspect ${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-${{ env.VARIANT }}${{ env.TAG_POSTFIX }}" + if: ${{ env.VARIANT == 'alpine' }} + run: docker inspect ${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-${{ env.VARIANT }}${{ env.TAG_POSTFIX }} + + - name: Login to dockerhub + uses: docker/login-action@v1 + 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 - ${{ matrix.platforms }} + if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} + env: + # platform is important! + DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }} + PLATFORM: ${{ matrix.platforms }} + # + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} + DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} + run: make push diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c3fd8f65..ad57783b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,7 @@ name: Docker PostGIS CI +# for building linux/amd64 ( x86-64 ) images ! + on: push: pull_request: @@ -37,16 +39,41 @@ jobs: runs-on: ubuntu-20.04 continue-on-error: ${{ matrix.postgis == 'master' }} env: + # Alpine image version + ALPINE_VERSION: '3.16' + # Workflow name for internal logic + WORKFLOW: main + # Docker image Repo and Image name + REPO_NAME: postgis + IMAGE_NAME: postgis + # Docker image version and variant VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }} VARIANT: ${{ matrix.variant }} + # Docker image tag postfix! in this case, no postfix! + TAG_POSTFIX: '' steps: - name: Checkout source - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - name: "debug: Inspect the base alpine image postgres:${{ matrix.postgres }}-alpine${{ env.ALPINE_VERSION }} " + if: ${{ env.VARIANT == 'alpine' }} + run: docker pull postgres:${{ matrix.postgres }}-alpine${{ env.ALPINE_VERSION }} && docker inspect postgres:${{ matrix.postgres }}-alpine${{ env.ALPINE_VERSION }} - - name: Build docker image for ${{ env.VERSION }} ${{ env.VARIANT }} + - name: Build docker image for ${{ env.VERSION }} ${{ env.VARIANT }}${{ env.TAG_POSTFIX }} run: make test + - name: "debug: docker images" + run: docker images + + - name: "debug: docker inspect ${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}${{ env.TAG_POSTFIX }}" + if: ${{ env.VARIANT == 'default' }} + run: docker inspect ${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}${{ env.TAG_POSTFIX }} + + - name: "debug: docker inspect ${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-${{ env.VARIANT }}${{ env.TAG_POSTFIX }}" + if: ${{ env.VARIANT == 'alpine' }} + run: docker inspect ${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-${{ env.VARIANT }}${{ env.TAG_POSTFIX }} + - name: Login to dockerhub uses: docker/login-action@v1 if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} diff --git a/10-3.2/Dockerfile b/10-3.2/Dockerfile index 14b6db4a..4ec9b78f 100644 --- a/10-3.2/Dockerfile +++ b/10-3.2/Dockerfile @@ -6,6 +6,9 @@ ENV POSTGIS_MAJOR 3 ENV POSTGIS_VERSION 3.2.3+dfsg-1.pgdg110+1 RUN apt-get update \ + # buildx debug info + && uname -a && uname -m && lscpu \ + \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; diff --git a/10-3.2/alpine/Dockerfile b/10-3.2/alpine/Dockerfile index 6f7e3c2a..d80399d2 100644 --- a/10-3.2/alpine/Dockerfile +++ b/10-3.2/alpine/Dockerfile @@ -90,11 +90,32 @@ RUN set -eux \ && make -j$(nproc) \ && make install \ \ +# buildx platform check for debug. + && uname -a && uname -m && cat /proc/cpuinfo \ + \ # regress check && mkdir /tempdb \ && chown -R postgres:postgres /tempdb \ && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb start' \ + \ + # QEMU7.0/BUILDX - JIT workaround + && if [[ "$(uname -m)" == "aarch64" && "10" != "10" ]] || \ + [[ "$(uname -m)" == "ppc64le" && "10" != "10" ]]; then \ + set -eux \ + # for the buildx/qemu workflow + # with (aarch64 ppc64le) and PG>10 .. we are testing with JIT=OFF to avoid QEMU7.0/BUILDX error + && echo "WARNING: JIT=OFF testing (aarch64 ppc64le)!" \ + && echo "## WARNING: tested with JIT=OFF (aarch64 ppc64le)!" >> /_pgis_full_version.txt \ + && su postgres -c 'pg_ctl -o "--jit=off" -D /tempdb start' \ + && su postgres -c 'psql -c "SHOW JIT;"' \ + ; \ + else \ + set -eux \ + # default test .. no problem expected. + && su postgres -c 'pg_ctl -D /tempdb start' \ + ; \ + fi \ + \ && cd regress \ && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ #&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \ diff --git a/11-3.3/Dockerfile b/11-3.3/Dockerfile index f36521ff..f53e36a4 100644 --- a/11-3.3/Dockerfile +++ b/11-3.3/Dockerfile @@ -6,6 +6,9 @@ ENV POSTGIS_MAJOR 3 ENV POSTGIS_VERSION 3.3.1+dfsg-2.pgdg110+1 RUN apt-get update \ + # buildx debug info + && uname -a && uname -m && lscpu \ + \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; diff --git a/11-3.3/alpine/Dockerfile b/11-3.3/alpine/Dockerfile index b5675063..bfa7877d 100644 --- a/11-3.3/alpine/Dockerfile +++ b/11-3.3/alpine/Dockerfile @@ -90,11 +90,32 @@ RUN set -eux \ && make -j$(nproc) \ && make install \ \ +# buildx platform check for debug. + && uname -a && uname -m && cat /proc/cpuinfo \ + \ # regress check && mkdir /tempdb \ && chown -R postgres:postgres /tempdb \ && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb start' \ + \ + # QEMU7.0/BUILDX - JIT workaround + && if [[ "$(uname -m)" == "aarch64" && "11" != "10" ]] || \ + [[ "$(uname -m)" == "ppc64le" && "11" != "10" ]]; then \ + set -eux \ + # for the buildx/qemu workflow + # with (aarch64 ppc64le) and PG>10 .. we are testing with JIT=OFF to avoid QEMU7.0/BUILDX error + && echo "WARNING: JIT=OFF testing (aarch64 ppc64le)!" \ + && echo "## WARNING: tested with JIT=OFF (aarch64 ppc64le)!" >> /_pgis_full_version.txt \ + && su postgres -c 'pg_ctl -o "--jit=off" -D /tempdb start' \ + && su postgres -c 'psql -c "SHOW JIT;"' \ + ; \ + else \ + set -eux \ + # default test .. no problem expected. + && su postgres -c 'pg_ctl -D /tempdb start' \ + ; \ + fi \ + \ && cd regress \ && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ #&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \ diff --git a/12-3.3/Dockerfile b/12-3.3/Dockerfile index 008675bd..d8336a0f 100644 --- a/12-3.3/Dockerfile +++ b/12-3.3/Dockerfile @@ -6,6 +6,9 @@ ENV POSTGIS_MAJOR 3 ENV POSTGIS_VERSION 3.3.1+dfsg-2.pgdg110+1 RUN apt-get update \ + # buildx debug info + && uname -a && uname -m && lscpu \ + \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; diff --git a/12-3.3/alpine/Dockerfile b/12-3.3/alpine/Dockerfile index d1761f09..8a579927 100644 --- a/12-3.3/alpine/Dockerfile +++ b/12-3.3/alpine/Dockerfile @@ -90,11 +90,32 @@ RUN set -eux \ && make -j$(nproc) \ && make install \ \ +# buildx platform check for debug. + && uname -a && uname -m && cat /proc/cpuinfo \ + \ # regress check && mkdir /tempdb \ && chown -R postgres:postgres /tempdb \ && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb start' \ + \ + # QEMU7.0/BUILDX - JIT workaround + && if [[ "$(uname -m)" == "aarch64" && "12" != "10" ]] || \ + [[ "$(uname -m)" == "ppc64le" && "12" != "10" ]]; then \ + set -eux \ + # for the buildx/qemu workflow + # with (aarch64 ppc64le) and PG>10 .. we are testing with JIT=OFF to avoid QEMU7.0/BUILDX error + && echo "WARNING: JIT=OFF testing (aarch64 ppc64le)!" \ + && echo "## WARNING: tested with JIT=OFF (aarch64 ppc64le)!" >> /_pgis_full_version.txt \ + && su postgres -c 'pg_ctl -o "--jit=off" -D /tempdb start' \ + && su postgres -c 'psql -c "SHOW JIT;"' \ + ; \ + else \ + set -eux \ + # default test .. no problem expected. + && su postgres -c 'pg_ctl -D /tempdb start' \ + ; \ + fi \ + \ && cd regress \ && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ #&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \ diff --git a/13-3.3/Dockerfile b/13-3.3/Dockerfile index 69f1ee7d..9c26407e 100644 --- a/13-3.3/Dockerfile +++ b/13-3.3/Dockerfile @@ -6,6 +6,9 @@ ENV POSTGIS_MAJOR 3 ENV POSTGIS_VERSION 3.3.1+dfsg-2.pgdg110+1 RUN apt-get update \ + # buildx debug info + && uname -a && uname -m && lscpu \ + \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; diff --git a/13-3.3/alpine/Dockerfile b/13-3.3/alpine/Dockerfile index bab2f1ac..24670912 100644 --- a/13-3.3/alpine/Dockerfile +++ b/13-3.3/alpine/Dockerfile @@ -90,11 +90,32 @@ RUN set -eux \ && make -j$(nproc) \ && make install \ \ +# buildx platform check for debug. + && uname -a && uname -m && cat /proc/cpuinfo \ + \ # regress check && mkdir /tempdb \ && chown -R postgres:postgres /tempdb \ && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb start' \ + \ + # QEMU7.0/BUILDX - JIT workaround + && if [[ "$(uname -m)" == "aarch64" && "13" != "10" ]] || \ + [[ "$(uname -m)" == "ppc64le" && "13" != "10" ]]; then \ + set -eux \ + # for the buildx/qemu workflow + # with (aarch64 ppc64le) and PG>10 .. we are testing with JIT=OFF to avoid QEMU7.0/BUILDX error + && echo "WARNING: JIT=OFF testing (aarch64 ppc64le)!" \ + && echo "## WARNING: tested with JIT=OFF (aarch64 ppc64le)!" >> /_pgis_full_version.txt \ + && su postgres -c 'pg_ctl -o "--jit=off" -D /tempdb start' \ + && su postgres -c 'psql -c "SHOW JIT;"' \ + ; \ + else \ + set -eux \ + # default test .. no problem expected. + && su postgres -c 'pg_ctl -D /tempdb start' \ + ; \ + fi \ + \ && cd regress \ && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ #&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \ diff --git a/14-3.3/Dockerfile b/14-3.3/Dockerfile index 7689071c..cb793c95 100644 --- a/14-3.3/Dockerfile +++ b/14-3.3/Dockerfile @@ -6,6 +6,9 @@ ENV POSTGIS_MAJOR 3 ENV POSTGIS_VERSION 3.3.1+dfsg-2.pgdg110+1 RUN apt-get update \ + # buildx debug info + && uname -a && uname -m && lscpu \ + \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; diff --git a/14-3.3/alpine/Dockerfile b/14-3.3/alpine/Dockerfile index 5fe17106..4635eae2 100644 --- a/14-3.3/alpine/Dockerfile +++ b/14-3.3/alpine/Dockerfile @@ -90,11 +90,32 @@ RUN set -eux \ && make -j$(nproc) \ && make install \ \ +# buildx platform check for debug. + && uname -a && uname -m && cat /proc/cpuinfo \ + \ # regress check && mkdir /tempdb \ && chown -R postgres:postgres /tempdb \ && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb start' \ + \ + # QEMU7.0/BUILDX - JIT workaround + && if [[ "$(uname -m)" == "aarch64" && "14" != "10" ]] || \ + [[ "$(uname -m)" == "ppc64le" && "14" != "10" ]]; then \ + set -eux \ + # for the buildx/qemu workflow + # with (aarch64 ppc64le) and PG>10 .. we are testing with JIT=OFF to avoid QEMU7.0/BUILDX error + && echo "WARNING: JIT=OFF testing (aarch64 ppc64le)!" \ + && echo "## WARNING: tested with JIT=OFF (aarch64 ppc64le)!" >> /_pgis_full_version.txt \ + && su postgres -c 'pg_ctl -o "--jit=off" -D /tempdb start' \ + && su postgres -c 'psql -c "SHOW JIT;"' \ + ; \ + else \ + set -eux \ + # default test .. no problem expected. + && su postgres -c 'pg_ctl -D /tempdb start' \ + ; \ + fi \ + \ && cd regress \ && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ #&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \ diff --git a/15-3.3/Dockerfile b/15-3.3/Dockerfile index 77b7364c..101256d9 100644 --- a/15-3.3/Dockerfile +++ b/15-3.3/Dockerfile @@ -6,6 +6,9 @@ ENV POSTGIS_MAJOR 3 ENV POSTGIS_VERSION 3.3.1+dfsg-2.pgdg110+1 RUN apt-get update \ + # buildx debug info + && uname -a && uname -m && lscpu \ + \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; diff --git a/15-3.3/alpine/Dockerfile b/15-3.3/alpine/Dockerfile index 1aba9e74..a77801c3 100644 --- a/15-3.3/alpine/Dockerfile +++ b/15-3.3/alpine/Dockerfile @@ -90,11 +90,32 @@ RUN set -eux \ && make -j$(nproc) \ && make install \ \ +# buildx platform check for debug. + && uname -a && uname -m && cat /proc/cpuinfo \ + \ # regress check && mkdir /tempdb \ && chown -R postgres:postgres /tempdb \ && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb start' \ + \ + # QEMU7.0/BUILDX - JIT workaround + && if [[ "$(uname -m)" == "aarch64" && "15" != "10" ]] || \ + [[ "$(uname -m)" == "ppc64le" && "15" != "10" ]]; then \ + set -eux \ + # for the buildx/qemu workflow + # with (aarch64 ppc64le) and PG>10 .. we are testing with JIT=OFF to avoid QEMU7.0/BUILDX error + && echo "WARNING: JIT=OFF testing (aarch64 ppc64le)!" \ + && echo "## WARNING: tested with JIT=OFF (aarch64 ppc64le)!" >> /_pgis_full_version.txt \ + && su postgres -c 'pg_ctl -o "--jit=off" -D /tempdb start' \ + && su postgres -c 'psql -c "SHOW JIT;"' \ + ; \ + else \ + set -eux \ + # default test .. no problem expected. + && su postgres -c 'pg_ctl -D /tempdb start' \ + ; \ + fi \ + \ && cd regress \ && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ #&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \ diff --git a/Dockerfile.alpine.template b/Dockerfile.alpine.template index a3a97a27..a01603d4 100644 --- a/Dockerfile.alpine.template +++ b/Dockerfile.alpine.template @@ -90,11 +90,32 @@ RUN set -eux \ && make -j$(nproc) \ && make install \ \ +# buildx platform check for debug. + && uname -a && uname -m && cat /proc/cpuinfo \ + \ # regress check && mkdir /tempdb \ && chown -R postgres:postgres /tempdb \ && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb start' \ + \ + # QEMU7.0/BUILDX - JIT workaround + && if [[ "$(uname -m)" == "aarch64" && "%%PG_MAJOR%%" != "10" ]] || \ + [[ "$(uname -m)" == "ppc64le" && "%%PG_MAJOR%%" != "10" ]]; then \ + set -eux \ + # for the buildx/qemu workflow + # with (aarch64 ppc64le) and PG>10 .. we are testing with JIT=OFF to avoid QEMU7.0/BUILDX error + && echo "WARNING: JIT=OFF testing (aarch64 ppc64le)!" \ + && echo "## WARNING: tested with JIT=OFF (aarch64 ppc64le)!" >> /_pgis_full_version.txt \ + && su postgres -c 'pg_ctl -o "--jit=off" -D /tempdb start' \ + && su postgres -c 'psql -c "SHOW JIT;"' \ + ; \ + else \ + set -eux \ + # default test .. no problem expected. + && su postgres -c 'pg_ctl -D /tempdb start' \ + ; \ + fi \ + \ && cd regress \ && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \ #&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \ diff --git a/Dockerfile.template b/Dockerfile.template index 17bbfe0f..81adcec0 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -6,6 +6,9 @@ ENV POSTGIS_MAJOR %%POSTGIS_MAJOR%% ENV POSTGIS_VERSION %%POSTGIS_VERSION%% RUN apt-get update \ + # buildx debug info + && uname -a && uname -m && lscpu \ + \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ && apt-get install -y --no-install-recommends \ # ca-certificates: for accessing remote raster files; diff --git a/Makefile b/Makefile index a4e8aacc..80d89d03 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,11 @@ +# Used environmnet variables: +# VERSION: 15-3.3,14-3.3,13-3.3, ... +# VARIANT: <>, alpine ( debian or alpine ) +# WORKFLOW: main,buildx ( workflow id ) +# TAG_POSTFIX: <>,'-experimental' ( Docker image tag postfix ) +# + # 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. @@ -11,6 +18,18 @@ LATEST_VERSION=15-3.3 do_default=true do_alpine=true +# There are multiple workflows in the .github/workflows/* +# The default WORKFLOW is the main.yml ( amd64 ) but can be overriden via environment variables. +WORKFLOW ?= main + +# IF this is NOT the 'main' workflow THEN we add special image tag postfix. +# ( -experimental ; it can be overriden via environment variables. ) +ifeq ($(WORKFLOW),main) + TAG_POSTFIX ?= +else + TAG_POSTFIX ?= -experimental +endif + # 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. @@ -76,11 +95,11 @@ update: define build-version build-$1: ifeq ($(do_default),true) - $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1 + $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)$(TAG_POSTFIX) $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) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine$(TAG_POSTFIX) $1/alpine endif endif endef @@ -99,11 +118,11 @@ test: $(foreach version,$(VERSIONS),test-$(version)) 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) + $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version)$(TAG_POSTFIX) 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 + $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine$(TAG_POSTFIX) endif endif endef @@ -113,7 +132,7 @@ $(foreach version,$(VERSIONS),$(eval $(call test-version,$(version)))) ### RULES FOR TAGGING ### tag-latest: $(BUILD_LATEST_DEP) - $(DOCKER) image tag $(REPO_NAME)/$(IMAGE_NAME):$(LATEST_VERSION) $(REPO_NAME)/$(IMAGE_NAME):latest + $(DOCKER) image tag $(REPO_NAME)/$(IMAGE_NAME):$(LATEST_VERSION) $(REPO_NAME)/$(IMAGE_NAME):latest$(TAG_POSTFIX) ### RULES FOR PUSHING ### @@ -123,24 +142,26 @@ push: $(foreach version,$(VERSIONS),push-$(version)) $(PUSH_DEP) define push-version push-$1: test-$1 ifeq ($(do_default),true) - $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version) + $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version)$(TAG_POSTFIX) endif ifeq ($(do_alpine),true) ifneq ("$(wildcard $1/alpine)","") - $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine + $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine$(TAG_POSTFIX) endif endif endef $(foreach version,$(VERSIONS),$(eval $(call push-version,$(version)))) push-latest: tag-latest $(PUSH_LATEST_DEP) - $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):latest - @$(DOCKER) run -v "$(PWD)":/workspace \ + $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):latest$(TAG_POSTFIX) + + ifeq ($(WORKFLOW),main) + @$(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) - + endif .PHONY: build all update test-prepare test tag-latest push push-latest \ $(foreach version,$(VERSIONS),build-$(version)) \ diff --git a/README.md b/README.md index 5329cc2f..6bc266a5 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Unless `-e POSTGRES_DB` is passed to the container at startup time, this databas Recomended version for the new users: `postgis/postgis:15-3.3` -### Debian based ( recomended ): +### Debian based : linux/amd64 (X86-64) ( recomended ): * It's conservative in its release cycle to ensure high stability. * *"conservative"* ~= not the latest geos, proj, gdal packages. @@ -35,7 +35,7 @@ Recomended version for the new users: `postgis/postgis:15-3.3` | [postgis/postgis:13-3.3](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=13-3.3) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/13-3.3/Dockerfile) | debian:bullseye | 13 | 3.3.1 | | [postgis/postgis:14-3.3](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-3.3) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-3.3/Dockerfile) | debian:bullseye | 14 | 3.3.1 | | [postgis/postgis:15-3.3](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-3.3) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-3.3/Dockerfile) | debian:bullseye | 15 | 3.3.1 | -### Alpine based +### Alpine based : linux/amd64 (X86-64) * base os = [Alpine linux](https://alpinelinux.org/): designed to be small, simple and secure ; [musl libc](https://musl.libc.org/) based * alpine:3.16; geos=3.10; gdal=3.5; proj=9.0 @@ -51,7 +51,7 @@ Recomended version for the new users: `postgis/postgis:15-3.3` | [postgis/postgis:14-3.3-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-3.3-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-3.3/alpine/Dockerfile) | alpine:3.16 | 14 | 3.3.1 | | [postgis/postgis:15-3.3-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-3.3-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-3.3/alpine/Dockerfile) | alpine:3.16 | 15 | 3.3.1 | -### Test images +### Test images : linux/amd64 (X86-64) * alpha, beta, rc and development ( ~master ) versions * the template for `*-master` images is updated manually, so sometimes there is a delay of a few weeks. @@ -61,6 +61,36 @@ Recomended version for the new users: `postgis/postgis:15-3.3` | [postgis/postgis:14-master](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-master) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-master/Dockerfile) | debian:bullseye | 14 | development: postgis, geos, proj, gdal | | [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 | +### Experimental linux/arm64 images + +* buildx/qemu based images +* the arm64 - alpine version tested with JIT=OFF ( BUILDX/QEMU7.0 problem ! ) +* generated from the default Dockerfile just added an `-experimental` tag postfix! + +| Platform | DockerHub image |PG | PostGIS | OS | +| ------------ | ---------------------------------------------|-- |---------| --------------- | +|`linux/arm64` | `postgis/postgis:10-3.2-experimental` |10 | 3.2 | debian:bullseye | +|`linux/arm64` | `postgis/postgis:11-3.3-experimental` |11 | 3.3 | debian:bullseye | +|`linux/arm64` | `postgis/postgis:12-3.3-experimental` |12 | 3.3 | debian:bullseye | +|`linux/arm64` | `postgis/postgis:13-3.3-experimental` |13 | 3.3 | debian:bullseye | +|`linux/arm64` | `postgis/postgis:14-3.3-experimental` |14 | 3.3 | debian:bullseye | +|`linux/arm64` | `postgis/postgis:15-3.3-experimental` |15 | 3.3 | debian:bullseye | +|`linux/arm64` | `postgis/postgis:15-3.3-alpine-experimental` |15 | 3.3 | alpine:3.16 | + +### Other Experimental images + +* buildx/qemu based images +* the ppc64le - alpine version tested with JIT=OFF ( BUILDX/QEMU7.0 problem ! ) +* generated from the default Dockerfile just added an `-experimental` tag postfix! + +| Platform | DockerHub image |PG | PostGIS | OS | +| --------------- | ---------------------------------------------|-- |---------| --------------- | +| `linux/arm/v7 ` | `postgis/postgis:15-3.3-alpine-experimental` | 15| 3.3 | alpine:3.16 | +| `linux/arm/v6 ` | `postgis/postgis:15-3.3-alpine-experimental` | 15| 3.3 | alpine:3.16 | +| `linux/386 ` | `postgis/postgis:15-3.3-alpine-experimental` | 15| 3.3 | alpine:3.16 | +| `linux/ppc64le` | `postgis/postgis:15-3.3-alpine-experimental` | 15| 3.3 | alpine:3.16 | +| `linux/ppc64le` | `postgis/postgis:15-3.3-experimental` | 15| 3.3 | debian:bullseye | + ## Usage In order to run a basic container capable of serving a PostGIS-enabled database, start a container as follows: diff --git a/test/tests/postgis-basics/run.sh b/test/tests/postgis-basics/run.sh index d04be5ac..4d3b7cfc 100755 --- a/test/tests/postgis-basics/run.sh +++ b/test/tests/postgis-basics/run.sh @@ -3,6 +3,11 @@ set -e image="$1" +# buildx debug: +uname -a +uname -m +cat /proc/cpuinfo + export POSTGRES_USER='my cool postgres user' export POSTGRES_PASSWORD='my cool postgres password' export POSTGRES_DB='my cool postgres database' @@ -24,7 +29,10 @@ psql() { "$@" } -tries=10 +: ${POSTGRES_TEST_TRIES:=10} +: ${POSTGRES_TEST_SLEEP:=2} + +tries="$POSTGRES_TEST_TRIES" while ! echo 'SELECT 1' | psql &> /dev/null; do (( tries-- )) if [ $tries -le 0 ]; then @@ -32,7 +40,7 @@ while ! echo 'SELECT 1' | psql &> /dev/null; do echo 'SELECT 1' | psql # to hopefully get a useful error message false fi - sleep 2 + sleep "$POSTGRES_TEST_SLEEP" done echo 'SELECT PostGIS_Version()' | psql diff --git a/update.sh b/update.sh index 4151fa25..a91f7b85 100755 --- a/update.sh +++ b/update.sh @@ -23,6 +23,7 @@ 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 +defaultAlpineSuite='3.16' defaultDebianSuite='bullseye-slim' declare -A debianSuite=( # https://github.com/docker-library/postgres/issues/582 @@ -177,7 +178,7 @@ for version in "${versions[@]}"; do mv "$version/$variant/Dockerfile.alpine.template" "$version/$variant/Dockerfile" sed -i 's/%%PG_MAJOR%%/'"$postgresVersion"'/g; s/%%POSTGIS_VERSION%%/'"$srcVersion"'/g; s/%%POSTGIS_SHA256%%/'"$srcSha256"'/g' "$version/$variant/Dockerfile" - echo "| [postgis/postgis:${version}-${variant}](${dockerhublink}${version}-${variant}) | [Dockerfile](${githubrepolink}/${version}/${variant}/Dockerfile) | alpine:3.16 | ${postgresVersion} | ${postgisDocSrc} |" >> _dockerlists_${optimized}.md + echo "| [postgis/postgis:${version}-${variant}](${dockerhublink}${version}-${variant}) | [Dockerfile](${githubrepolink}/${version}/${variant}/Dockerfile) | alpine:${defaultAlpineSuite} | ${postgresVersion} | ${postgisDocSrc} |" >> _dockerlists_${optimized}.md ) done done