|
FROM python:3.10.9 |
|
|
|
|
|
RUN addgroup --gid 1001 appgroup && adduser --uid 1001 --gid 1001 --disabled-password --gecos "" appuser |
|
|
|
|
|
RUN mkdir -p /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR /home/appuser/.local /opt/venv /home/appuser/.cache/tts |
|
RUN chown -R appuser:appgroup /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR /home/appuser/.local /opt/venv /home/appuser/.cache/tts |
|
|
|
|
|
ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/ |
|
ENV MPLCONFIGDIR=/tmp/MPLCONFIGDIR/ |
|
ENV HOME=/home/appuser |
|
ENV PATH="/opt/venv/bin:$PATH" |
|
|
|
|
|
COPY . . |
|
|
|
|
|
WORKDIR / |
|
|
|
|
|
RUN python -m venv /opt/venv |
|
|
|
|
|
RUN chown -R appuser:appgroup /opt/venv |
|
|
|
|
|
USER appuser |
|
|
|
|
|
RUN /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ |
|
/opt/venv/bin/pip install --no-cache-dir --upgrade -r /requirements.txt |
|
|
|
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |
|
|