Skip to content

Use docker-entrypoint-initdb.d #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 9.0-2.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ RUN apt-get update \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

# Need to replace upstream entrypoint to allow postgis initialization
COPY ./docker-entrypoint.sh /
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
27 changes: 0 additions & 27 deletions 9.0-2.1/docker-entrypoint.sh

This file was deleted.

11 changes: 11 additions & 0 deletions 9.0-2.1/initdb-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
POSTGRES="gosu postgres postgres"

$POSTGRES --single -E <<EOSQL
CREATE DATABASE template_postgis
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'
EOSQL

POSTGIS_CONFIG=/usr/share/postgresql/$PG_MAJOR/contrib/postgis-$POSTGIS_MAJOR
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/postgis.sql
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/spatial_ref_sys.sql
4 changes: 2 additions & 2 deletions 9.1-2.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ RUN apt-get update \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

# Need to replace upstream entrypoint to allow postgis initialization
COPY ./docker-entrypoint.sh /
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
27 changes: 0 additions & 27 deletions 9.1-2.1/docker-entrypoint.sh

This file was deleted.

11 changes: 11 additions & 0 deletions 9.1-2.1/initdb-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
POSTGRES="gosu postgres postgres"

$POSTGRES --single -E <<EOSQL
CREATE DATABASE template_postgis
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'
EOSQL

POSTGIS_CONFIG=/usr/share/postgresql/$PG_MAJOR/contrib/postgis-$POSTGIS_MAJOR
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/postgis.sql
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/spatial_ref_sys.sql
4 changes: 2 additions & 2 deletions 9.2-2.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ RUN apt-get update \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

# Need to replace upstream entrypoint to allow postgis initialization
COPY ./docker-entrypoint.sh /
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
27 changes: 0 additions & 27 deletions 9.2-2.1/docker-entrypoint.sh

This file was deleted.

11 changes: 11 additions & 0 deletions 9.2-2.1/initdb-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
POSTGRES="gosu postgres postgres"

$POSTGRES --single -E <<EOSQL
CREATE DATABASE template_postgis
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'
EOSQL

POSTGIS_CONFIG=/usr/share/postgresql/$PG_MAJOR/contrib/postgis-$POSTGIS_MAJOR
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/postgis.sql
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/spatial_ref_sys.sql
4 changes: 2 additions & 2 deletions 9.3-2.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ RUN apt-get update \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

# Need to replace upstream entrypoint to allow postgis initialization
COPY ./docker-entrypoint.sh /
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
27 changes: 0 additions & 27 deletions 9.3-2.1/docker-entrypoint.sh

This file was deleted.

11 changes: 11 additions & 0 deletions 9.3-2.1/initdb-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
POSTGRES="gosu postgres postgres"

$POSTGRES --single -E <<EOSQL
CREATE DATABASE template_postgis
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'
EOSQL

POSTGIS_CONFIG=/usr/share/postgresql/$PG_MAJOR/contrib/postgis-$POSTGIS_MAJOR
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/postgis.sql
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/spatial_ref_sys.sql
4 changes: 2 additions & 2 deletions 9.4-2.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ RUN apt-get update \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

# Need to replace upstream entrypoint to allow postgis initialization
COPY ./docker-entrypoint.sh /
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
27 changes: 0 additions & 27 deletions 9.4-2.1/docker-entrypoint.sh

This file was deleted.

11 changes: 11 additions & 0 deletions 9.4-2.1/initdb-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
POSTGRES="gosu postgres postgres"

$POSTGRES --single -E <<EOSQL
CREATE DATABASE template_postgis
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'
EOSQL

POSTGIS_CONFIG=/usr/share/postgresql/$PG_MAJOR/contrib/postgis-$POSTGIS_MAJOR
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/postgis.sql
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/spatial_ref_sys.sql
4 changes: 2 additions & 2 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ RUN apt-get update \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*

# Need to replace upstream entrypoint to allow postgis initialization
COPY ./docker-entrypoint.sh /
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
27 changes: 0 additions & 27 deletions docker-entrypoint.sh

This file was deleted.

11 changes: 11 additions & 0 deletions initdb-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
POSTGRES="gosu postgres postgres"

$POSTGRES --single -E <<EOSQL
CREATE DATABASE template_postgis
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'
EOSQL

POSTGIS_CONFIG=/usr/share/postgresql/$PG_MAJOR/contrib/postgis-$POSTGIS_MAJOR
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/postgis.sql
$POSTGRES --single template_postgis -j < $POSTGIS_CONFIG/spatial_ref_sys.sql
4 changes: 2 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ for version in "${versions[@]}"; do
IFS=- read pg_major postgis_major <<< "$version"
fullVersion="$(grep -m1 -A10 "^Package: postgresql-$pg_major-postgis-$postgis_major\$" "$packages" | grep -m1 '^Version: ' | cut -d' ' -f2)"
(
set -x
cp docker-entrypoint.sh Dockerfile.template README.md "$version/"
set -x
cp Dockerfile.template initdb-postgis.sh README.md "$version/"
mv "$version/Dockerfile.template" "$version/Dockerfile"
sed -i 's/%%PG_MAJOR%%/'$pg_major'/g; s/%%POSTGIS_MAJOR%%/'$postgis_major'/g; s/%%POSTGIS_VERSION%%/'$fullVersion'/g' "$version/Dockerfile"
)
Expand Down