From ad67d1a7292fc981af6d7c8239ffc21b69e1dc8b Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Tue, 14 Feb 2017 15:31:54 +0530 Subject: [PATCH 1/2] config: move default config var to Dockerfile --- bitnami/postgresql/Dockerfile | 13 +++++++++++-- bitnami/postgresql/rootfs/app-entrypoint.sh | 10 ---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/bitnami/postgresql/Dockerfile b/bitnami/postgresql/Dockerfile index 39fbe849d426..9923542bc438 100644 --- a/bitnami/postgresql/Dockerfile +++ b/bitnami/postgresql/Dockerfile @@ -11,11 +11,20 @@ RUN install_packages libc6 libssl1.0.0 zlib1g libxml2 liblzma5 libedit2 libbsd0 # Install postgresql RUN bitnami-pkg unpack postgresql-9.6.2-0 --checksum b706396cc1a435741e4db319f8028d716047cc4d40e6b3418c16944f6661f90f -ENV PATH=/opt/bitnami/$BITNAMI_APP_NAME/sbin:/opt/bitnami/$BITNAMI_APP_NAME/bin:$PATH +ENV PATH=/opt/bitnami/postgresql/sbin:/opt/bitnami/postgresql/bin:$PATH COPY rootfs / -VOLUME ["/bitnami/$BITNAMI_APP_NAME"] +ENV POSTGRESQL_USERNAME=postgres \ + POSTGRESQL_PASSWORD= \ + POSTGRESQL_DATABASE= \ + POSTGRESQL_REPLICATION_MODE=master \ + POSTGRESQL_REPLICATION_USER= \ + POSTGRESQL_REPLICATION_PASSWORD= \ + POSTGRESQL_MASTER_HOST= \ + POSTGRESQL_MASTER_PORT=5432 + +VOLUME ["/bitnami/postgresql"] EXPOSE 5432 diff --git a/bitnami/postgresql/rootfs/app-entrypoint.sh b/bitnami/postgresql/rootfs/app-entrypoint.sh index 9fd149f42a37..5d1f2895cd94 100755 --- a/bitnami/postgresql/rootfs/app-entrypoint.sh +++ b/bitnami/postgresql/rootfs/app-entrypoint.sh @@ -13,16 +13,6 @@ function initialize { fi } -# Set default values -export POSTGRESQL_USERNAME=${POSTGRESQL_USERNAME:-postgres} -export POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD:-} -export POSTGRESQL_DATABASE=${POSTGRESQL_DATABASE:-} -export POSTGRESQL_REPLICATION_MODE=${POSTGRESQL_REPLICATION_MODE:-master} -export POSTGRESQL_REPLICATION_USER=${POSTGRESQL_REPLICATION_USER:-} -export POSTGRESQL_REPLICATION_PASSWORD=${POSTGRESQL_REPLICATION_PASSWORD:-} -export POSTGRESQL_MASTER_HOST=${POSTGRESQL_MASTER_HOST:-} -export POSTGRESQL_MASTER_PORT=${POSTGRESQL_MASTER_PORT:-5432} - if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then initialize postgresql echo "Starting application ..." From e4e0a7b0af34e9dee4a56ccb2425cb64850cc733 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Tue, 14 Feb 2017 15:32:16 +0530 Subject: [PATCH 2/2] entrypoint: remove references to `entrypoint.sh` from base image --- bitnami/postgresql/Dockerfile | 4 +--- bitnami/postgresql/rootfs/app-entrypoint.sh | 24 +++++++-------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/bitnami/postgresql/Dockerfile b/bitnami/postgresql/Dockerfile index 9923542bc438..5e5651a9355a 100644 --- a/bitnami/postgresql/Dockerfile +++ b/bitnami/postgresql/Dockerfile @@ -3,15 +3,13 @@ MAINTAINER Bitnami ENV BITNAMI_IMAGE_VERSION=9.6.2-r0 \ BITNAMI_APP_NAME=postgresql \ - BITNAMI_APP_USER=postgres - + PATH=/opt/bitnami/postgresql/bin:$PATH # System packages required RUN install_packages libc6 libssl1.0.0 zlib1g libxml2 liblzma5 libedit2 libbsd0 libtinfo5 libxslt1.1 # Install postgresql RUN bitnami-pkg unpack postgresql-9.6.2-0 --checksum b706396cc1a435741e4db319f8028d716047cc4d40e6b3418c16944f6661f90f -ENV PATH=/opt/bitnami/postgresql/sbin:/opt/bitnami/postgresql/bin:$PATH COPY rootfs / diff --git a/bitnami/postgresql/rootfs/app-entrypoint.sh b/bitnami/postgresql/rootfs/app-entrypoint.sh index 5d1f2895cd94..05ab18276e8a 100755 --- a/bitnami/postgresql/rootfs/app-entrypoint.sh +++ b/bitnami/postgresql/rootfs/app-entrypoint.sh @@ -1,21 +1,13 @@ #!/bin/bash -e +. /opt/bitnami/base/functions +. /opt/bitnami/base/helpers -function initialize { - # Package can be "installed" or "unpacked" - status=`nami inspect $1` - if [[ "$status" == *'"lifecycle": "unpacked"'* ]]; then - # Clean up inputs - inputs="" - if [[ -f /$1-inputs.json ]]; then - inputs=--inputs-file=/$1-inputs.json - fi - nami initialize $1 $inputs - fi -} +print_welcome_page +check_for_updates & -if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then - initialize postgresql - echo "Starting application ..." +if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then + nami_initialize postgresql + info "Starting postgresql..." fi -exec /entrypoint.sh "$@" +exec tini -- "$@"