diff --git a/10/Dockerfile.c8s b/10/Dockerfile.c8s index 9aff4d3e..36eaa28c 100644 --- a/10/Dockerfile.c8s +++ b/10/Dockerfile.c8s @@ -9,6 +9,8 @@ FROM quay.io/sclorg/s2i-core-c8s:c8s # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=10 \ POSTGRESQL_PREV_VERSION=9.6 \ diff --git a/10/Dockerfile.rhel7 b/10/Dockerfile.rhel7 index acb94437..6ab07c71 100644 --- a/10/Dockerfile.rhel7 +++ b/10/Dockerfile.rhel7 @@ -9,6 +9,8 @@ FROM rhscl/s2i-core-rhel7 # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=10 \ POSTGRESQL_PREV_VERSION=9.6 \ diff --git a/10/Dockerfile.rhel8 b/10/Dockerfile.rhel8 index e188c7e5..71fb91bd 100644 --- a/10/Dockerfile.rhel8 +++ b/10/Dockerfile.rhel8 @@ -9,6 +9,8 @@ FROM ubi8/s2i-core # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=10 \ POSTGRESQL_PREV_VERSION=9.6 \ diff --git a/10/root/usr/share/container-scripts/postgresql/common.sh b/10/root/usr/share/container-scripts/postgresql/common.sh index 29e91dd8..9d67a317 100644 --- a/10/root/usr/share/container-scripts/postgresql/common.sh +++ b/10/root/usr/share/container-scripts/postgresql/common.sh @@ -201,7 +201,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/10/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -234,7 +237,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then diff --git a/12/Dockerfile.c8s b/12/Dockerfile.c8s index 946cd278..5728244e 100644 --- a/12/Dockerfile.c8s +++ b/12/Dockerfile.c8s @@ -9,6 +9,8 @@ FROM quay.io/sclorg/s2i-core-c8s:c8s # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=12 \ POSTGRESQL_PREV_VERSION=10 \ diff --git a/12/Dockerfile.fedora b/12/Dockerfile.fedora index f596e65f..a4fe4b93 100644 --- a/12/Dockerfile.fedora +++ b/12/Dockerfile.fedora @@ -9,6 +9,8 @@ FROM quay.io/fedora/s2i-core:38 # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV NAME=postgresql \ VERSION=0 \ diff --git a/12/Dockerfile.rhel7 b/12/Dockerfile.rhel7 index 75e7b688..c8a4a695 100644 --- a/12/Dockerfile.rhel7 +++ b/12/Dockerfile.rhel7 @@ -9,6 +9,8 @@ FROM rhscl/s2i-core-rhel7 # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=12 \ POSTGRESQL_PREV_VERSION=10 \ diff --git a/12/Dockerfile.rhel8 b/12/Dockerfile.rhel8 index e83fd4fe..e7a868b1 100644 --- a/12/Dockerfile.rhel8 +++ b/12/Dockerfile.rhel8 @@ -9,6 +9,8 @@ FROM ubi8/s2i-core # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=12 \ POSTGRESQL_PREV_VERSION=10 \ diff --git a/12/root/usr/share/container-scripts/postgresql/common.sh b/12/root/usr/share/container-scripts/postgresql/common.sh index e917c39d..aac8d729 100644 --- a/12/root/usr/share/container-scripts/postgresql/common.sh +++ b/12/root/usr/share/container-scripts/postgresql/common.sh @@ -201,7 +201,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/12/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -234,7 +237,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then diff --git a/13/Dockerfile.c8s b/13/Dockerfile.c8s index 60130b92..0772796c 100644 --- a/13/Dockerfile.c8s +++ b/13/Dockerfile.c8s @@ -9,6 +9,8 @@ FROM quay.io/sclorg/s2i-core-c8s:c8s # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=13 \ POSTGRESQL_PREV_VERSION=12 \ diff --git a/13/Dockerfile.c9s b/13/Dockerfile.c9s index 65bdb635..45a3e17c 100644 --- a/13/Dockerfile.c9s +++ b/13/Dockerfile.c9s @@ -9,6 +9,8 @@ FROM quay.io/sclorg/s2i-core-c9s:c9s # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=13 \ POSTGRESQL_PREV_VERSION=12 \ diff --git a/13/Dockerfile.fedora b/13/Dockerfile.fedora index 7031f394..7f85b1bd 100644 --- a/13/Dockerfile.fedora +++ b/13/Dockerfile.fedora @@ -9,6 +9,8 @@ FROM quay.io/fedora/s2i-core:38 # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV NAME=postgresql \ VERSION=0 \ diff --git a/13/Dockerfile.rhel7 b/13/Dockerfile.rhel7 index 93939459..a9840318 100644 --- a/13/Dockerfile.rhel7 +++ b/13/Dockerfile.rhel7 @@ -9,6 +9,8 @@ FROM rhscl/s2i-core-rhel7 # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=13 \ POSTGRESQL_PREV_VERSION=12 \ diff --git a/13/Dockerfile.rhel8 b/13/Dockerfile.rhel8 index 986c1e67..ab795842 100644 --- a/13/Dockerfile.rhel8 +++ b/13/Dockerfile.rhel8 @@ -9,6 +9,8 @@ FROM ubi8/s2i-core # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=13 \ POSTGRESQL_PREV_VERSION=12 \ diff --git a/13/Dockerfile.rhel9 b/13/Dockerfile.rhel9 index 50b91331..13c1ee63 100644 --- a/13/Dockerfile.rhel9 +++ b/13/Dockerfile.rhel9 @@ -9,6 +9,8 @@ FROM ubi9/s2i-core # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=13 \ POSTGRESQL_PREV_VERSION=12 \ diff --git a/13/root/usr/share/container-scripts/postgresql/common.sh b/13/root/usr/share/container-scripts/postgresql/common.sh index 5b166305..7f77705d 100644 --- a/13/root/usr/share/container-scripts/postgresql/common.sh +++ b/13/root/usr/share/container-scripts/postgresql/common.sh @@ -201,7 +201,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/13/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -234,7 +237,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then diff --git a/14/Dockerfile.fedora b/14/Dockerfile.fedora index 6cc888ee..85e6fa06 100644 --- a/14/Dockerfile.fedora +++ b/14/Dockerfile.fedora @@ -9,6 +9,8 @@ FROM quay.io/fedora/s2i-core:38 # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV NAME=postgresql \ VERSION=0 \ diff --git a/14/root/usr/share/container-scripts/postgresql/common.sh b/14/root/usr/share/container-scripts/postgresql/common.sh index 53ed955f..538cd244 100644 --- a/14/root/usr/share/container-scripts/postgresql/common.sh +++ b/14/root/usr/share/container-scripts/postgresql/common.sh @@ -201,7 +201,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/14/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -234,7 +237,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then diff --git a/15/Dockerfile.c8s b/15/Dockerfile.c8s index 9dbb7809..a7658873 100644 --- a/15/Dockerfile.c8s +++ b/15/Dockerfile.c8s @@ -9,6 +9,8 @@ FROM quay.io/sclorg/s2i-core-c8s:c8s # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=15 \ POSTGRESQL_PREV_VERSION=13 \ diff --git a/15/Dockerfile.c9s b/15/Dockerfile.c9s index 7d8fcba8..8b5be9b4 100644 --- a/15/Dockerfile.c9s +++ b/15/Dockerfile.c9s @@ -9,6 +9,8 @@ FROM quay.io/sclorg/s2i-core-c9s:c9s # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=15 \ POSTGRESQL_PREV_VERSION=13 \ diff --git a/15/Dockerfile.fedora b/15/Dockerfile.fedora index 762cfbb1..05984472 100644 --- a/15/Dockerfile.fedora +++ b/15/Dockerfile.fedora @@ -9,6 +9,8 @@ FROM quay.io/fedora/s2i-core:38 # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV NAME=postgresql \ VERSION=0 \ diff --git a/15/Dockerfile.rhel8 b/15/Dockerfile.rhel8 index b68f9781..0b8e1742 100644 --- a/15/Dockerfile.rhel8 +++ b/15/Dockerfile.rhel8 @@ -9,6 +9,8 @@ FROM ubi8/s2i-core # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=15 \ POSTGRESQL_PREV_VERSION=13 \ diff --git a/15/Dockerfile.rhel9 b/15/Dockerfile.rhel9 index 51d003e1..683c8a2d 100644 --- a/15/Dockerfile.rhel9 +++ b/15/Dockerfile.rhel9 @@ -9,6 +9,8 @@ FROM ubi9/s2i-core # * $POSTGRESQL_DATABASE - Name of the database to create # * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' # PostgreSQL administrative account +# * $POSTGRESQL_ENCODING - Database encoding. Default to UTF8 +# * $POSTGRESQL_LOCALE - Database locale. Default to en_US ENV POSTGRESQL_VERSION=15 \ POSTGRESQL_PREV_VERSION=13 \ diff --git a/15/root/usr/share/container-scripts/postgresql/common.sh b/15/root/usr/share/container-scripts/postgresql/common.sh index 0428cd0e..7836d1e1 100644 --- a/15/root/usr/share/container-scripts/postgresql/common.sh +++ b/15/root/usr/share/container-scripts/postgresql/common.sh @@ -201,7 +201,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/15/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -234,7 +237,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then