add entrypoint

This commit is contained in:
TDLaouer 2025-07-13 18:57:25 +02:00
parent a866a92443
commit 456402c5e5
2 changed files with 23 additions and 1 deletions

View File

@ -9,4 +9,10 @@ RUN pip install --upgrade pip
COPY ./requirements.txt .
RUN pip install -r requirements.txt
COPY ./entrypoint.sh .
RUN sed -i 's/\r$//g' /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh
COPY . .
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]

16
entrypoint.sh Normal file
View File

@ -0,0 +1,16 @@
if [ "$DATABASE" = "postgres" ]
then
echo "Waiting for postgres..."
while ! nc -z $SQL_HOST $SQL_PORT; do
sleep 0.1
done
echo "PostgreSQL started"
fi
python manage.py flush --no-input
python manage.py migrate
exec "$@"