Mauro Rosero P
1909eedcf8
- Se crea la funcion builder.sh que crea imagenes de contenedores - Se corrige la correcta creación del archivo .gitignore - Se corrigen errores en el archivo dockerfile.local para la correcta construcción de contenedor - Se eliminan las otras plantillas de dockerfile - Otras modificaciones y correcciones menores
150 lines
3.3 KiB
Bash
Executable file
150 lines
3.3 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# builder.sh
|
|
# Modified: 2024/12/04 14:47:00
|
|
# Derechos de Autor (C) [2024] [Mauro Rosero P. <mauro@roser.one>]
|
|
#
|
|
# Este programa es software libre: usted puede redistribuirlo y/o modificarlo
|
|
# bajo los términos de la Licencia Pública Affero General de GNU tal como
|
|
# lo publica la Free Software Foundation, ya sea la versión 3 de la licencia,
|
|
# o (a su elección) cualquier versión posterior.
|
|
#
|
|
# Este programa se distribuye con la esperanza de que sea útil,
|
|
# pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de
|
|
# COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la
|
|
# Licencia Pública Affero General de GNU para obtener más detalles.
|
|
#
|
|
# Debería haber recibido una copia de la Licencia Pública Affero General
|
|
# junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>.
|
|
|
|
PROGRAM_NAME="BUILDER CONTAINER (DEVSTOOLS)"
|
|
DEVSPATH=developers
|
|
DEVSTEAM=odoo
|
|
BIN_HOME=$HOME/$DEVSPATH/$DEVSTEAM
|
|
BIN_MESG=bin/msg
|
|
BIN_LIBS=bin/lib
|
|
VERSION="$(cat $BIN_HOME/config/project.version)"
|
|
DATENOW="$(date +"%Y-%m-%d %H:%M:%S")"
|
|
|
|
# CHECK SHELL LANGUAGE
|
|
BIN_LANG=${LANG:0:2}
|
|
|
|
# LOAD BASE BASH LIBRARY
|
|
source $BIN_HOME/$BIN_LIBS/base.lib
|
|
#baselib_test
|
|
|
|
# LOAD CONSOLE BASH LIBRARY
|
|
source $BIN_HOME/$BIN_LIBS/console.lib
|
|
APPS_NAME="$(cat $BIN_HOME/$DEVS_NAME)"
|
|
#consolelib_test
|
|
|
|
# LOAD ODOO BASH LIBRARY
|
|
source $BIN_HOME/$BIN_LIBS/odoo.lib
|
|
#odoolib_test
|
|
|
|
# Load head messages
|
|
load_messages $BIN_HOME $BIN_MESG $BIN_LANG "head"
|
|
|
|
# Load container messages
|
|
load_messages $BIN_HOME $BIN_MESG $BIN_LANG "container"
|
|
|
|
# Load odoo messages
|
|
load_messages $BIN_HOME $BIN_MESG $BIN_LANG "odoo"
|
|
|
|
# Function to display help message
|
|
function help() {
|
|
echo "$comsg_003_1 $0 $comsg_003_2"
|
|
echo "$comsg_004"
|
|
echo "$comsg_005"
|
|
echo "$comsg_006"
|
|
echo "$comsg_007"
|
|
}
|
|
|
|
########### MAIN PROGRAM ###########
|
|
|
|
# Display Headers
|
|
display_text_header $BIN_HOME "${head_000} ${comsg_101}"
|
|
|
|
# Check for arguments option
|
|
help=false
|
|
version=false
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--help)
|
|
help=true
|
|
shift
|
|
;;
|
|
--version)
|
|
version=true
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Check to show help
|
|
if $help; then
|
|
help
|
|
exit 0
|
|
fi
|
|
|
|
# Check to show command version
|
|
if $version; then
|
|
echo "$PROGRAM_NAME"
|
|
echo "$head_version $VERSION"
|
|
exit 0
|
|
fi
|
|
|
|
# Set project name
|
|
PROJECT_NAME="$(basename "$PWD")"
|
|
|
|
# Check if project path is ok
|
|
DIR_NAME="$(dirname "$PWD")"
|
|
if [ "${DIR_NAME}" != "${BIN_HOME}" ]
|
|
then
|
|
echo "${head_error}: ${head_noproject}"
|
|
exit 2
|
|
fi
|
|
|
|
# Check if os is valid!
|
|
get_osname
|
|
if [ "${os_name}" == "${head_unknow}" ]
|
|
then
|
|
echo "${head_error}: ${head_os_error}"
|
|
exit 3
|
|
fi
|
|
|
|
# Check if .env file exists
|
|
if [ ! -f "$PWD/.env" ]
|
|
then
|
|
echo "${head_error}: ${head_noenv}"
|
|
exit 4
|
|
fi
|
|
|
|
# Check if build path exists
|
|
if [ ! -d "$PWD/$DOCKER_BUILD" ]
|
|
then
|
|
echo "${head_error}: ${head_nobuild}"
|
|
exit 5
|
|
fi
|
|
|
|
# Check if build path exists
|
|
if [ ! -f "$PWD/$DOCKER_BUILD/$DOCKER_FILE" ]
|
|
then
|
|
echo "${head_error}: ${head_nodockerfile}"
|
|
exit 6
|
|
fi
|
|
|
|
# Build odoo container
|
|
source "$PWD/.env"
|
|
CONTAINER="${DEVSTEAM}:${ODOO_CONTAINER}_${ODOO_VERSION}"
|
|
echo "$head_container ${CONTAINER}"
|
|
build_container "${CONTAINER}" "${DEVSTEAM}:${ODOO_VERSION}"
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo "${head_error}: ${head_nobuilded}"
|
|
exit 10
|
|
fi
|
|
|
|
echo "${head_info}: ${head_builded}"
|
|
exit 0
|
|
|