diff --git a/bin/configure.sh b/bin/configure.sh index c56e8df..9a9b478 100755 --- a/bin/configure.sh +++ b/bin/configure.sh @@ -75,7 +75,7 @@ function odoo_configure_form() { c_hlp[1]="${odhlp_001}" c_mod[1]=1 c_opt[1]=0 - c_def[1]="$BIN_HOME/data/$PROJECT_NAME/db" + c_def[1]="$BIN_HOME/data/${PROJECT_NAME}/db" c_val[1]=0 c_dat[1]="" # Input: Path Odoo Data @@ -84,7 +84,7 @@ function odoo_configure_form() { c_mod[2]=1 c_opt[2]=0 c_val[2]=0 - c_def[2]="$BIN_HOME/data/$PROJECT_NAME/files" + c_def[2]="$BIN_HOME/data/${PROJECT_NAME}/files" c_dat[2]="" # Input: Path Odoo Backup c_lbl[3]="${odlbl_003}" diff --git a/bin/lib/base.lib b/bin/lib/base.lib index 410f21e..819b323 100644 --- a/bin/lib/base.lib +++ b/bin/lib/base.lib @@ -25,6 +25,7 @@ DOCKER_BASE=dockerfile.base DOCKER_SAAS=dockerfile.saas DOCKER_BUILD=build DOCKER_FILE=Dockerfile +DOCKER_ENTRY=entrypoint.sh # Test library function baselib_test() { diff --git a/bin/lib/odoo.lib b/bin/lib/odoo.lib index 4c770b1..5f95bfc 100644 --- a/bin/lib/odoo.lib +++ b/bin/lib/odoo.lib @@ -99,11 +99,31 @@ function copy_dockerfile() { local ODOO_PATH=$1 local ODOO_PROJ=$2 - local DOCKERFILE=$3 + local BUILDTEMPLATE=$3 + local BUILDFILE=$4 - if [ ! -f "$ODOO_PATH/$ODOO_PROJ/$DOCKER_BUILD/$DOCKER_FILE" ] + if [ ! -f "$ODOO_PATH/$ODOO_PROJ/$DOCKER_BUILD/$BUILDFILE" ] then - cp $DOCKERFILE "$ODOO_PATH/$ODOO_PROJ/$DOCKER_BUILD/$DOCKER_FILE" + cp $BUILDTEMPLATE "$ODOO_PATH/$ODOO_PROJ/$DOCKER_BUILD/$BUILDFILE" + if [ $? -eq 0 ] + then + echo "[x] $odmsg_009" + fi + fi + +} + +# Copy docker entrypoint.sh file to root project path +function copy_entrypoint() { + + local ODOO_PATH=$1 + local ODOO_PROJ=$2 + local ENTRYTEMPLATE=$3 + local ENTRYPOINT=$4 + + if [ ! -f "$ODOO_PATH/$ODOO_PROJ/$ENTRYPOINT" ] + then + cp $ENTRYTEMPLATE "$ODOO_PATH/$ODOO_PROJ/$ENTRYPOINT" if [ $? -eq 0 ] then echo "[x] $odmsg_009" diff --git a/bin/project.sh b/bin/project.sh index 935f694..cdf5f8f 100755 --- a/bin/project.sh +++ b/bin/project.sh @@ -122,7 +122,10 @@ fi odoo_structure $BIN_HOME "$PROJECT_NAME" # Copy dockerfile template file to build (local) -copy_dockerfile $BIN_HOME "$PROJECT_NAME" "$BIN_HOME/$ODOO_CFG/$DOCKER_LOCAL" +copy_dockerfile $BIN_HOME "$PROJECT_NAME" "$BIN_HOME/$ODOO_CFG/$DOCKER_LOCAL" "$DOCKER_FILE" + +# Copy entrypoint template file to build (local) +copy_dockerfile $BIN_HOME "$PROJECT_NAME" "$BIN_HOME/$ODOO_CFG/$DOCKER_ENTRY" "$DOCKER_ENTRY" # Copy odoo config template file to etc (base) copy_odooconfig $BIN_HOME "$PROJECT_NAME" "$BIN_HOME/$ODOO_CFG/$ODOO_CFG_BASE" diff --git a/config/entrypoint.sh b/config/entrypoint.sh new file mode 100644 index 0000000..6e1d438 --- /dev/null +++ b/config/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +# set the postgres database host, port, user and password according to the environment +# and pass them as arguments to the odoo process if not present in the config file +: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}} +: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}} +: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}} +: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo15@2021'}}} + +# install python packages +pip3 install pip --upgrade +pip3 install -r /etc/odoo/requirements.txt +