Files
jobs/Dockerfile
zwitschi dd9772997d extending Dockerfile with lang and locale settings
changing debian mirror for faster installation
2025-09-14 15:20:00 +02:00

65 lines
1.7 KiB
Docker

# 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
# Set apt sources to use a faster mirror: https://mirror.init7.net/debian/
RUN sed -i 's|http://deb.debian.org/debian|https://mirror.init7.net/debian|g' /etc/apt/sources.list
# Update lang and locale settings
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
RUN apt-get update && apt-get install -y locales
RUN sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
default-libmysqlclient-dev \
default-mysql-client \
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"]