Files
jobs/Dockerfile
zwitschi fee955f01d
Some checks failed
CI/CD Pipeline / test (push) Successful in 18s
CI/CD Pipeline / build (push) Successful in 1m3s
CI/CD Pipeline / push (push) Failing after 35s
fix: update Dockerfile and documentation for APT_CACHER_NG configuration
2025-11-01 19:41:58 +01:00

52 lines
1.2 KiB
Docker

# Use Python 3.11 slim image
FROM python:3.11-slim-bookworm
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV FLASK_ENV=production
# Add apt-cacher-ng configuration (if APT_CACHER_NG is set)
RUN if [ -n "$APT_CACHER_NG" ]; then echo 'Acquire::http { Proxy "'"$APT_CACHER_NG"'/"; };' > /etc/apt/apt.conf.d/01proxy; fi
# 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"]