50 lines
1.2 KiB
Docker
50 lines
1.2 KiB
Docker
FROM python:3.11-slim
|
|
|
|
LABEL maintainer="Quality App Team"
|
|
LABEL description="Quality App v2 - Flask Application with MariaDB"
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
FLASK_APP=run.py
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
mariadb-client \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create application directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --upgrade pip && \
|
|
pip install -r requirements.txt && \
|
|
pip install gunicorn
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /app/data/{logs,uploads,backups} && \
|
|
chmod -R 755 /app/data
|
|
|
|
# Copy and make entrypoint executable
|
|
COPY docker-entrypoint.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
|
CMD curl -f http://localhost:8080/login || exit 1
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Entry point
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
CMD ["gunicorn", "--config", "gunicorn.conf.py", "wsgi:app"]
|