Actualiser 2.build.postgresql.sh

This commit is contained in:
lpierson 2026-04-20 17:51:59 +00:00
parent 2bee146b30
commit 93cebfa267

View file

@ -1,6 +1,28 @@
#cd postgresql-config
#docker build -t postgres15-5434-image .
#!/bin/bash
set -euo pipefail
NEW_PORT=5455
DIR=./config-postgresql
mkdir -p "$DIR"
cat > "$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 = $NEW_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
sed -i -E "s/^([[:space:]]*)db_port[[:space:]]*=.*/\1db_port = $NEW_PORT/" ./odoo.conf
sed -i "s/postgres15-5434/postgres15-$NEW_PORT/g" ./docker-compose.yml
docker build \
-f ./config-postgresql/Dockerfile \
-t postgres15-5434-image .
#cd ..
-f "$DIR/Dockerfile" \
-t "postgres15-$NEW_PORT-image" .