[FIXED] Entrypoint.sh

- Se agrega archivo entrypoint.sh a plantillas de configuración
- Se agrega funcionalidad para copiar plantilla entrypoint.sh a la raíz del proyecto
- Otras modificaciones menores
This commit is contained in:
Mauro Rosero P. 2024-12-07 10:14:16 -05:00
parent 230c6c59ca
commit c1721b5168
Signed by: mrosero
GPG key ID: 83BD2A5F674B7E26
5 changed files with 45 additions and 6 deletions

View file

@ -75,7 +75,7 @@ function odoo_configure_form() {
c_hlp[1]="${odhlp_001}" c_hlp[1]="${odhlp_001}"
c_mod[1]=1 c_mod[1]=1
c_opt[1]=0 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_val[1]=0
c_dat[1]="" c_dat[1]=""
# Input: Path Odoo Data # Input: Path Odoo Data
@ -84,7 +84,7 @@ function odoo_configure_form() {
c_mod[2]=1 c_mod[2]=1
c_opt[2]=0 c_opt[2]=0
c_val[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]="" c_dat[2]=""
# Input: Path Odoo Backup # Input: Path Odoo Backup
c_lbl[3]="${odlbl_003}" c_lbl[3]="${odlbl_003}"

View file

@ -25,6 +25,7 @@ DOCKER_BASE=dockerfile.base
DOCKER_SAAS=dockerfile.saas DOCKER_SAAS=dockerfile.saas
DOCKER_BUILD=build DOCKER_BUILD=build
DOCKER_FILE=Dockerfile DOCKER_FILE=Dockerfile
DOCKER_ENTRY=entrypoint.sh
# Test library # Test library
function baselib_test() { function baselib_test() {

View file

@ -99,11 +99,31 @@ function copy_dockerfile() {
local ODOO_PATH=$1 local ODOO_PATH=$1
local ODOO_PROJ=$2 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 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 ] if [ $? -eq 0 ]
then then
echo "[x] $odmsg_009" echo "[x] $odmsg_009"

View file

@ -122,7 +122,10 @@ fi
odoo_structure $BIN_HOME "$PROJECT_NAME" odoo_structure $BIN_HOME "$PROJECT_NAME"
# Copy dockerfile template file to build (local) # 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 odoo config template file to etc (base)
copy_odooconfig $BIN_HOME "$PROJECT_NAME" "$BIN_HOME/$ODOO_CFG/$ODOO_CFG_BASE" copy_odooconfig $BIN_HOME "$PROJECT_NAME" "$BIN_HOME/$ODOO_CFG/$ODOO_CFG_BASE"

15
config/entrypoint.sh Normal file
View file

@ -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