diff --git a/Dockerfile b/Dockerfile index 47521a1..9082b6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,9 @@ RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . +# Make entrypoint script executable +RUN chmod +x /app/docker-entrypoint.sh + # Create volume for persistent database storage VOLUME ["/app/instance"] @@ -37,4 +40,4 @@ USER myuser EXPOSE 5000 # Command to run the application -CMD ["gunicorn", "-c", "gunicorn.conf.py", "app:app"] +ENTRYPOINT ["/app/docker-entrypoint.sh"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..81cef89 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Initialize the database using init_db.py +python init_db.py + +# Start gunicorn +exec gunicorn -c gunicorn.conf.py app:app