Skip to content

Commit bd55962

Browse files
committed
Add support for NPROC build arg
1 parent eaf0d74 commit bd55962

File tree

11 files changed

+73
-37
lines changed

11 files changed

+73
-37
lines changed

13-3.5/alpine/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ARG BASE_IMAGE=postgres:13-alpine3.22
55
FROM ${BASE_IMAGE}
66

7+
ARG NPROC
8+
ENV NPROC=${NPROC}
9+
710
LABEL maintainer="PostGIS Project - https://postgis.net" \
811
org.opencontainers.image.description="PostGIS 3.5.4 spatial database extension with PostgreSQL 13 Alpine" \
912
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -62,7 +65,7 @@ RUN set -eux \
6265
&& ./autogen.sh \
6366
&& ./configure \
6467
--enable-lto \
65-
&& make -j$(nproc) \
68+
&& make -j${NPROC:=$(nproc)} \
6669
&& make install \
6770
\
6871
# This section is for refreshing the proj data for the regression tests.
@@ -78,7 +81,7 @@ RUN set -eux \
7881
&& su postgres -c 'pg_ctl -D /tempdb init' \
7982
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
8083
&& cd regress \
81-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
84+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
8285
\
8386
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
8487
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

14-3.5/alpine/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ARG BASE_IMAGE=postgres:14-alpine3.22
55
FROM ${BASE_IMAGE}
66

7+
ARG NPROC
8+
ENV NPROC=${NPROC}
9+
710
LABEL maintainer="PostGIS Project - https://postgis.net" \
811
org.opencontainers.image.description="PostGIS 3.5.4 spatial database extension with PostgreSQL 14 Alpine" \
912
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -62,7 +65,7 @@ RUN set -eux \
6265
&& ./autogen.sh \
6366
&& ./configure \
6467
--enable-lto \
65-
&& make -j$(nproc) \
68+
&& make -j${NPROC:=$(nproc)} \
6669
&& make install \
6770
\
6871
# This section is for refreshing the proj data for the regression tests.
@@ -78,7 +81,7 @@ RUN set -eux \
7881
&& su postgres -c 'pg_ctl -D /tempdb init' \
7982
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
8083
&& cd regress \
81-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
84+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
8285
\
8386
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
8487
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

15-3.5/alpine/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ARG BASE_IMAGE=postgres:15-alpine3.22
55
FROM ${BASE_IMAGE}
66

7+
ARG NPROC
8+
ENV NPROC=${NPROC}
9+
710
LABEL maintainer="PostGIS Project - https://postgis.net" \
811
org.opencontainers.image.description="PostGIS 3.5.4 spatial database extension with PostgreSQL 15 Alpine" \
912
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -62,7 +65,7 @@ RUN set -eux \
6265
&& ./autogen.sh \
6366
&& ./configure \
6467
--enable-lto \
65-
&& make -j$(nproc) \
68+
&& make -j${NPROC:=$(nproc)} \
6669
&& make install \
6770
\
6871
# This section is for refreshing the proj data for the regression tests.
@@ -78,7 +81,7 @@ RUN set -eux \
7881
&& su postgres -c 'pg_ctl -D /tempdb init' \
7982
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
8083
&& cd regress \
81-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
84+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
8285
\
8386
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
8487
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

16-3.5/alpine/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ARG BASE_IMAGE=postgres:16-alpine3.22
55
FROM ${BASE_IMAGE}
66

7+
ARG NPROC
8+
ENV NPROC=${NPROC}
9+
710
LABEL maintainer="PostGIS Project - https://postgis.net" \
811
org.opencontainers.image.description="PostGIS 3.5.4 spatial database extension with PostgreSQL 16 Alpine" \
912
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -62,7 +65,7 @@ RUN set -eux \
6265
&& ./autogen.sh \
6366
&& ./configure \
6467
--enable-lto \
65-
&& make -j$(nproc) \
68+
&& make -j${NPROC:=$(nproc)} \
6669
&& make install \
6770
\
6871
# This section is for refreshing the proj data for the regression tests.
@@ -78,7 +81,7 @@ RUN set -eux \
7881
&& su postgres -c 'pg_ctl -D /tempdb init' \
7982
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
8083
&& cd regress \
81-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
84+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
8285
\
8386
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
8487
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

16-master/Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ ARG DOCKER_CMAKE_BUILD_TYPE=Release
99
ARG CGAL_GIT_BRANCH=main
1010
FROM docker.io/postgres:16-bullseye as builder
1111

12+
ARG NPROC
13+
ENV NPROC=${NPROC}
14+
1215
LABEL maintainer="PostGIS Project - https://postgis.net" \
1316
org.opencontainers.image.description="PostGIS - master spatial database extension with PostgreSQL 16 bullseye" \
1417
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -128,7 +131,7 @@ RUN set -ex \
128131
-DSFCGAL_BUILD_EXAMPLES=OFF \
129132
-DSFCGAL_BUILD_TESTS=OFF \
130133
-DSFCGAL_WITH_OSG=OFF \
131-
&& make -j$(nproc) \
134+
&& make -j${NPROC:=$(nproc)} \
132135
&& make install \
133136
#
134137
## testing with -DSFCGAL_BUILD_TESTS=ON
@@ -152,7 +155,7 @@ RUN set -ex \
152155
&& echo "autotools version: 'autogen.sh' exists! Older version!" \
153156
&& ./autogen.sh \
154157
&& ./configure --disable-static \
155-
&& make -j$(nproc) \
158+
&& make -j${NPROC:=$(nproc)} \
156159
&& make install \
157160
; \
158161
else \
@@ -161,7 +164,7 @@ RUN set -ex \
161164
&& mkdir build \
162165
&& cd build \
163166
&& cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \
164-
&& make -j$(nproc) \
167+
&& make -j${NPROC:=$(nproc)} \
165168
&& make install \
166169
; \
167170
fi \
@@ -179,7 +182,7 @@ RUN set -ex \
179182
&& mkdir cmake-build \
180183
&& cd cmake-build \
181184
&& cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \
182-
&& make -j$(nproc) \
185+
&& make -j${NPROC:=$(nproc)} \
183186
&& make install \
184187
&& cd / \
185188
&& rm -fr /usr/src/geos
@@ -249,7 +252,7 @@ RUN set -ex \
249252
; \
250253
fi \
251254
\
252-
&& make -j$(nproc) \
255+
&& make -j${NPROC:=$(nproc)} \
253256
&& make install \
254257
&& cd / \
255258
&& rm -fr /usr/src/gdal
@@ -271,6 +274,7 @@ RUN set -ex \
271274
# -------------------------------------------
272275
FROM docker.io/postgres:16-bullseye
273276

277+
ARG NPROC
274278
ARG DOCKER_CMAKE_BUILD_TYPE
275279
ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE}
276280

@@ -388,7 +392,7 @@ RUN set -ex \
388392
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
389393
&& ./configure \
390394
--enable-lto \
391-
&& make -j$(nproc) \
395+
&& make -j${NPROC:=$(nproc)} \
392396
&& make install \
393397
# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316
394398
&& projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \
@@ -402,7 +406,7 @@ RUN set -ex \
402406
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
403407
&& ldconfig \
404408
&& cd regress \
405-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
409+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
406410
\
407411
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
408412
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

17-3.5/alpine/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ARG BASE_IMAGE=postgres:17-alpine3.22
55
FROM ${BASE_IMAGE}
66

7+
ARG NPROC
8+
ENV NPROC=${NPROC}
9+
710
LABEL maintainer="PostGIS Project - https://postgis.net" \
811
org.opencontainers.image.description="PostGIS 3.5.4 spatial database extension with PostgreSQL 17 Alpine" \
912
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -62,7 +65,7 @@ RUN set -eux \
6265
&& ./autogen.sh \
6366
&& ./configure \
6467
--enable-lto \
65-
&& make -j$(nproc) \
68+
&& make -j${NPROC:=$(nproc)} \
6669
&& make install \
6770
\
6871
# This section is for refreshing the proj data for the regression tests.
@@ -78,7 +81,7 @@ RUN set -eux \
7881
&& su postgres -c 'pg_ctl -D /tempdb init' \
7982
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
8083
&& cd regress \
81-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
84+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
8285
\
8386
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
8487
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

17-3.6/alpine/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ARG BASE_IMAGE=postgres:17-alpine3.22
55
FROM ${BASE_IMAGE}
66

7+
ARG NPROC
8+
ENV NPROC=${NPROC}
9+
710
LABEL maintainer="PostGIS Project - https://postgis.net" \
811
org.opencontainers.image.description="PostGIS 3.6.1 spatial database extension with PostgreSQL 17 Alpine" \
912
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -62,7 +65,7 @@ RUN set -eux \
6265
&& ./autogen.sh \
6366
&& ./configure \
6467
--enable-lto \
65-
&& make -j$(nproc) \
68+
&& make -j${NPROC:=$(nproc)} \
6669
&& make install \
6770
\
6871
# This section is for refreshing the proj data for the regression tests.
@@ -78,7 +81,7 @@ RUN set -eux \
7881
&& su postgres -c 'pg_ctl -D /tempdb init' \
7982
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
8083
&& cd regress \
81-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
84+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
8285
\
8386
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
8487
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

17-master/Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ ARG DOCKER_CMAKE_BUILD_TYPE=Release
99
ARG CGAL_GIT_BRANCH=main
1010
FROM docker.io/postgres:17-bullseye as builder
1111

12+
ARG NPROC
13+
ENV NPROC=${NPROC}
14+
1215
LABEL maintainer="PostGIS Project - https://postgis.net" \
1316
org.opencontainers.image.description="PostGIS - master spatial database extension with PostgreSQL 17 bullseye" \
1417
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -128,7 +131,7 @@ RUN set -ex \
128131
-DSFCGAL_BUILD_EXAMPLES=OFF \
129132
-DSFCGAL_BUILD_TESTS=OFF \
130133
-DSFCGAL_WITH_OSG=OFF \
131-
&& make -j$(nproc) \
134+
&& make -j${NPROC:=$(nproc)} \
132135
&& make install \
133136
#
134137
## testing with -DSFCGAL_BUILD_TESTS=ON
@@ -152,7 +155,7 @@ RUN set -ex \
152155
&& echo "autotools version: 'autogen.sh' exists! Older version!" \
153156
&& ./autogen.sh \
154157
&& ./configure --disable-static \
155-
&& make -j$(nproc) \
158+
&& make -j${NPROC:=$(nproc)} \
156159
&& make install \
157160
; \
158161
else \
@@ -161,7 +164,7 @@ RUN set -ex \
161164
&& mkdir build \
162165
&& cd build \
163166
&& cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \
164-
&& make -j$(nproc) \
167+
&& make -j${NPROC:=$(nproc)} \
165168
&& make install \
166169
; \
167170
fi \
@@ -179,7 +182,7 @@ RUN set -ex \
179182
&& mkdir cmake-build \
180183
&& cd cmake-build \
181184
&& cmake .. -DCMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \
182-
&& make -j$(nproc) \
185+
&& make -j${NPROC:=$(nproc)} \
183186
&& make install \
184187
&& cd / \
185188
&& rm -fr /usr/src/geos
@@ -249,7 +252,7 @@ RUN set -ex \
249252
; \
250253
fi \
251254
\
252-
&& make -j$(nproc) \
255+
&& make -j${NPROC:=$(nproc)} \
253256
&& make install \
254257
&& cd / \
255258
&& rm -fr /usr/src/gdal
@@ -271,6 +274,7 @@ RUN set -ex \
271274
# -------------------------------------------
272275
FROM docker.io/postgres:17-bullseye
273276

277+
ARG NPROC
274278
ARG DOCKER_CMAKE_BUILD_TYPE
275279
ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE}
276280

@@ -388,7 +392,7 @@ RUN set -ex \
388392
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
389393
&& ./configure \
390394
--enable-lto \
391-
&& make -j$(nproc) \
395+
&& make -j${NPROC:=$(nproc)} \
392396
&& make install \
393397
# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316
394398
&& projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \
@@ -402,7 +406,7 @@ RUN set -ex \
402406
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
403407
&& ldconfig \
404408
&& cd regress \
405-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
409+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
406410
\
407411
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
408412
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

18-3.6/alpine/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ARG BASE_IMAGE=postgres:18-alpine3.22
55
FROM ${BASE_IMAGE}
66

7+
ARG NPROC
8+
ENV NPROC=${NPROC}
9+
710
LABEL maintainer="PostGIS Project - https://postgis.net" \
811
org.opencontainers.image.description="PostGIS 3.6.1 spatial database extension with PostgreSQL 18 Alpine" \
912
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -62,7 +65,7 @@ RUN set -eux \
6265
&& ./autogen.sh \
6366
&& ./configure \
6467
--enable-lto \
65-
&& make -j$(nproc) \
68+
&& make -j${NPROC:=$(nproc)} \
6669
&& make install \
6770
\
6871
# This section is for refreshing the proj data for the regression tests.
@@ -78,7 +81,7 @@ RUN set -eux \
7881
&& su postgres -c 'pg_ctl -D /tempdb init' \
7982
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
8083
&& cd regress \
81-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
84+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
8285
\
8386
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
8487
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

Dockerfile.alpine.template

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ARG BASE_IMAGE=postgres:%%PG_MAJOR%%-alpine3.22
55
FROM ${BASE_IMAGE}
66

7+
ARG NPROC
8+
ENV NPROC=${NPROC}
9+
710
LABEL maintainer="PostGIS Project - https://postgis.net" \
811
org.opencontainers.image.description="PostGIS %%POSTGIS_VERSION%% spatial database extension with PostgreSQL %%PG_MAJOR%% Alpine" \
912
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
@@ -62,7 +65,7 @@ RUN set -eux \
6265
&& ./autogen.sh \
6366
&& ./configure \
6467
--enable-lto \
65-
&& make -j$(nproc) \
68+
&& make -j${NPROC:=$(nproc)} \
6669
&& make install \
6770
\
6871
# This section is for refreshing the proj data for the regression tests.
@@ -78,7 +81,7 @@ RUN set -eux \
7881
&& su postgres -c 'pg_ctl -D /tempdb init' \
7982
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
8083
&& cd regress \
81-
&& make -j$(nproc) check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
84+
&& make -j${NPROC:=$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \
8285
\
8386
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
8487
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \

0 commit comments

Comments
 (0)