Prepare for fly.io

This commit is contained in:
2025-07-01 11:22:56 +02:00
committed by Jens Luedicke
parent de510baac1
commit 264144ebca
4 changed files with 101 additions and 1 deletions

36
Dockerfile Normal file
View File

@@ -0,0 +1,36 @@
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
FLASK_APP=app.py
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY . .
# Create the SQLite database directory with proper permissions
RUN mkdir -p /app/instance && chmod 777 /app/instance
# Expose the port the app runs on
EXPOSE 5000
# Run database migrations on startup
RUN python -c "from app import app, db; app.app_context().push(); db.create_all()"
# Command to run the application
CMD ["flask", "run", "--host=0.0.0.0", "--port=5000"]