|
|
|
|
|
FROM python:3.10-slim |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \ |
|
|
PYTHONUNBUFFERED=1 \ |
|
|
PIP_NO_CACHE_DIR=1 \ |
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
|
gcc \ |
|
|
g++ \ |
|
|
&& apt-get clean \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
COPY requirements.txt . |
|
|
|
|
|
|
|
|
RUN pip install --upgrade pip && \ |
|
|
pip install -r requirements.txt |
|
|
|
|
|
|
|
|
COPY . . |
|
|
|
|
|
|
|
|
RUN useradd --create-home --shell /bin/bash app && \ |
|
|
chown -R app:app /app |
|
|
USER app |
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ |
|
|
CMD python -c "import requests; requests.get('http://localhost:8000/health')" || exit 1 |
|
|
|
|
|
|
|
|
EXPOSE 8000 |
|
|
|
|
|
|
|
|
CMD ["python", "-m", "jupyter", "notebook", "--ip=0.0.0.0", "--port=8000", "--no-browser", "--allow-root"] |