Docker functionality

This commit is contained in:
georg.sinn-schirwitz
2025-09-08 14:51:04 +02:00
parent 042a196718
commit 5940e1f8b4
7 changed files with 440 additions and 0 deletions

48
Dockerfile Normal file
View File

@@ -0,0 +1,48 @@
# Use Python 3.11 slim image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV FLASK_ENV=production
ENV FLASK_SECRET=production-secret-change-me
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
default-libmysqlclient-dev \
pkg-config \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p cache logs
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/ || exit 1
# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Set entrypoint
ENTRYPOINT ["docker-entrypoint.sh"]
# Run gunicorn
CMD ["gunicorn", "--config", "gunicorn.conf.py", "web.app:app"]