From 135e226db82257ed8b15b3bd075ab6fe366fed39 Mon Sep 17 00:00:00 2001 From: Stef Date: Mon, 11 Aug 2025 01:25:02 +0200 Subject: [PATCH] Add entrypoint script for Docker container Introduces entrypoint.sh to handle database migrations before starting the Flask app. Updates Dockerfile to use the new entrypoint script and ensures it is executable. --- Dockerfile | 9 ++++----- entrypoint.sh | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 49be1d4..4dd3d3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,9 @@ FROM python:3.12-slim # Everything will be done in /app (Not in the main OS Image) WORKDIR /app - -COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt - COPY . . +RUN pip install --no-cache-dir -r requirements.txt +RUN chmod +x /entrypoint.sh -CMD ["python", "app.py"] +ENTRYPOINT ["/entrypoint.sh"] +CMD [] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..28e6098 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +echo "Running database migrations..." +flask db upgrade + +echo "Starting Flask app..." +python app.py \ No newline at end of file