| FROM python:3.9-slim |
|
|
| |
| ENV FLASK_APP=app.py |
| ENV FLASK_ENV=production |
| ENV PATH="/home/appuser/.local/bin:$PATH" |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| libgl1-mesa-glx \ |
| libglib2.0-0 \ |
| libsm6 \ |
| libxext6 \ |
| libxrender-dev \ |
| tesseract-ocr \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m appuser && mkdir -p /app /app/instance && chown -R appuser:appuser /app |
|
|
| |
| WORKDIR /app |
|
|
| |
| COPY --chown=appuser:appuser requirements.txt . |
| RUN pip install --no-cache-dir "numpy<2.0.0" && \ |
| pip install --no-cache-dir -r requirements.txt |
|
|
| |
| COPY --chown=appuser:appuser . . |
|
|
| |
| USER appuser |
|
|
| |
| EXPOSE 5000 |
|
|
| |
| CMD ["gunicorn", "--config=./gunicorn.conf.py", "--workers=2", "app:create_app()"] |