| FROM python:3.10-slim |
|
|
| ENV DEBIAN_FRONTEND=noninteractive \ |
| PYTHONDONTWRITEBYTECODE=1 \ |
| PYTHONUNBUFFERED=1 \ |
| PIP_NO_CACHE_DIR=1 \ |
| PYSTOW_HOME=/app/cache/pystow \ |
| PYTHONIOENCODING=UTF-8 \ |
| PORT=7860 |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| curl ca-certificates \ |
| libstdc++6 libgomp1 \ |
| libxrender1 libxext6 \ |
| tini \ |
| default-jre-headless \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| WORKDIR /app |
| RUN useradd -m -u 1000 user |
|
|
| COPY requirements.txt /app/requirements.txt |
| RUN pip install --upgrade pip && \ |
| pip install -r requirements.txt |
|
|
| |
| RUN mkdir -p /app/cache/pystow && chown -R user:user /app/cache |
|
|
| COPY --chown=user:user . /app |
|
|
| |
| USER user |
|
|
| |
| RUN python -c "from STOUT import translate_forward; print('Pre-loading model...'); translate_forward('C'); print('Complete.')" |
|
|
| EXPOSE $PORT |
| ENTRYPOINT ["/usr/bin/tini", "--"] |
| CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"] |