25 lines
573 B
Docker
25 lines
573 B
Docker
# Use an official Python runtime as a parent image
|
|
FROM python:3.11-slim-bullseye
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV APP_HOME=/app
|
|
WORKDIR $APP_HOME
|
|
|
|
# Install dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
RUN pip install gunicorn
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Tell Docker that the container listens on port 80
|
|
EXPOSE 80
|
|
|
|
# Set Flask app for CLI commands
|
|
ENV FLASK_APP=app.py
|
|
|
|
# Run database migrations and then the application
|
|
CMD flask db upgrade && gunicorn --bind 0.0.0.0:80 app:app
|