forked from ScoDoc/ScoDoc
Modification docker
- Utilisation de la dernière version de l'image postgres - Supression du cache pip après le build pour alléger l'image - Modification de la gestion de la variable d'environnement FLASK_ENV : - Comportement par défaut = production - Si la variable d'environnement FLASK_ENV est définie dans le docker-compose.yml, alors on utilise sa valeur
This commit is contained in:
parent
d7fce217ec
commit
777fee9379
@ -25,7 +25,8 @@ RUN apt-get update \
|
|||||||
&& chown -R scodoc:scodoc /opt/scodoc /opt/scodoc-data \
|
&& chown -R scodoc:scodoc /opt/scodoc /opt/scodoc-data \
|
||||||
&& apt-get install --yes curl gcc graphviz graphviz-dev libpq-dev cracklib-runtime libcrack2-dev libpango-1.0-0 pango1.0-tools python3-dev python3-venv python3-pip python3-wheel postgresql-client \
|
&& apt-get install --yes curl gcc graphviz graphviz-dev libpq-dev cracklib-runtime libcrack2-dev libpango-1.0-0 pango1.0-tools python3-dev python3-venv python3-pip python3-wheel postgresql-client \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& su -c "(cd /opt/scodoc && python3 -m venv venv && source venv/bin/activate && pip install wheel && pip install -r requirements-3.11.txt)" scodoc
|
&& su -c "(cd /opt/scodoc && python3 -m venv venv && source venv/bin/activate && pip install wheel && pip install -r requirements-3.11.txt)" scodoc \
|
||||||
|
&& rm -rf ~scodoc/.cache/pip
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ services:
|
|||||||
- db
|
- db
|
||||||
- cache
|
- cache
|
||||||
db:
|
db:
|
||||||
image: postgres:15
|
image: postgres
|
||||||
container_name: scodoc_db
|
container_name: scodoc_db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
@ -15,6 +15,10 @@ if [ -z "${SCODOC_DATABASE_URI}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "${FLASK_ENV}" ]; then
|
||||||
|
export FLASK_ENV=production
|
||||||
|
fi
|
||||||
|
|
||||||
db_name=$(echo $SCODOC_DATABASE_URI | sed -E 's/.*\/([^\/]+)$/\1/')
|
db_name=$(echo $SCODOC_DATABASE_URI | sed -E 's/.*\/([^\/]+)$/\1/')
|
||||||
|
|
||||||
if [[ "$db_name" == "$SCODOC_DATABASE_URI" ]]; then
|
if [[ "$db_name" == "$SCODOC_DATABASE_URI" ]]; then
|
||||||
@ -42,9 +46,8 @@ if ! [ -f /opt/scodoc-data/.env ]; then
|
|||||||
fi
|
fi
|
||||||
SECRET_KEY=$(python3 -c "import uuid; print(uuid.uuid4().hex)")
|
SECRET_KEY=$(python3 -c "import uuid; print(uuid.uuid4().hex)")
|
||||||
cat > /opt/scodoc-data/.env <<EOF
|
cat > /opt/scodoc-data/.env <<EOF
|
||||||
# .env for ScoDoc (production)
|
# .env for ScoDoc
|
||||||
FLASK_APP=scodoc.py
|
FLASK_APP=scodoc.py
|
||||||
FLASK_ENV=production
|
|
||||||
|
|
||||||
SCODOC_ADMIN_MAIL="$SCODOC_ADMIN_MAIL" # important: le mail de admin
|
SCODOC_ADMIN_MAIL="$SCODOC_ADMIN_MAIL" # important: le mail de admin
|
||||||
SECRET_KEY="$SECRET_KEY" # une chaine aléatoire"
|
SECRET_KEY="$SECRET_KEY" # une chaine aléatoire"
|
||||||
|
Loading…
Reference in New Issue
Block a user