odoov18-compta/1.0.gitclone.sh

89 lines
3.2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
source ./0.variables.env
mkdir -p odoo-filestore odoo-logs odoo-postgresql custom config-postgresql config-odoo
# Downlaod des repo OCA
for repo in \
https://github.com/OCA/account-analytic.git \
https://github.com/OCA/account-financial-reporting.git \
https://github.com/OCA/account-financial-tools.git \
https://github.com/OCA/account-invoicing.git \
https://github.com/OCA/account-payment.git \
https://github.com/OCA/account-reconcile.git \
https://github.com/OCA/bank-payment.git \
https://github.com/OCA/bank-statement-import.git \
https://github.com/OCA/community-data-files.git \
https://github.com/OCA/currency.git \
https://github.com/OCA/edi.git \
https://github.com/OCA/knowledge.git \
https://github.com/OCA/l10n-france.git \
https://github.com/OCA/mail.git \
https://github.com/OCA/mis-builder.git \
https://github.com/OCA/partner-contact.git \
https://github.com/OCA/queue.git \
https://github.com/OCA/reporting-engine.git \
https://github.com/OCA/sale-reporting.git \
https://github.com/OCA/sale-workflow.git \
https://github.com/OCA/server-auth.git \
https://github.com/OCA/server-brand.git \
https://github.com/OCA/server-tools.git \
https://github.com/OCA/server-ux.git \
https://github.com/OCA/social.git \
https://github.com/oca/web.git
do
name=$(basename "$repo" .git)
git clone -b 18.0 "$repo" "custom/$name"
#git clone -b 18.0 "$repo"
done
# Recupération du Dockerfile d'odoo 18
ODOO_DEST_DIR="./config-odoo/"
FILES=(Dockerfile entrypoint.sh odoo.conf wait-for-psql.py)
mkdir -p "${ODOO_DEST_DIR}"
for f in "${FILES[@]}"; do
curl -fsSL "${BASE}/${f}" -o "${ODOO_DEST_DIR}/${f}"
done
chmod +x "${ODOO_DEST_DIR}/entrypoint.sh" "${ODOO_DEST_DIR}/wait-for-psql.py"
sed -i 's/curl \\/curl vim \\/' "${ODOO_DEST_DIR}/Dockerfile"
sed -i 's|^COPY \./entrypoint\.sh /$|COPY ./requirements.txt /tmp/requirements.txt\nRUN pip install --no-cache-dir --break-system-packages -r /tmp/requirements.txt\nCOPY ./entrypoint.sh /|' "${ODOO_DEST_DIR}/Dockerfile"
# Création du Dockerfile de Postgresql
POSTGRESQL_DIR=./config-postgresql
mkdir -p "$POSTGRESQL_DIR"
cat > "$POSTGRESQL_DIR/Dockerfile" <<EOF
# Utiliser l'image officielle PostgreSQL 15
FROM postgres:15
# Changer le port d'écoute dans la configuration PostgreSQL
RUN sed -i 's/^#port = 5432/port = $POSTGRESQL_PORT/' /usr/share/postgresql/postgresql.conf.sample
# Copier la configuration dans le répertoire de configuration PostgreSQL
CMD ["postgres", "-c", "config_file=/usr/share/postgresql/postgresql.conf.sample"]
EOF
# update d'odoo.conf et de docker-compose.yml annulé car remplacé par des variables directement dans les fichiers ou template
# et utilisation de la commande
# envsubst < odoo.conf.template > odoo.conf
#sed -i -E "s/^([[:space:]]*)db_port[[:space:]]*=.*/\1db_port = $POSTGRESQL_PORT/" ./odoo.conf
#sed -i "s/postgres15-5434/postgres15-$POSTGRESQL_PORT/g" ./docker-compose.yml
#sed -i "s/postgres-XXXXXXXXXXXXXXXXXXXXXX/$POSTGRES_CONTAINER/g" ./docker-compose.yml
#sed -i "s/odoo-XXXXXXXXXXXXXXXXXXXXXX/$ODOO_CONTAINER/g" ./docker-compose.yml
#sed -i -E "s/^([[:space:]]*)db_host[[:space:]]*=.*/\1db_host = $POSTGRESQL_CONTAINER/" ./odoo.conf