|
FROM python:3.10.9 |
|
|
|
|
|
RUN addgroup --gid 1001 appgroup && adduser --uid 1001 --gid 1001 --disabled-password --gecos "" appuser |
|
|
|
|
|
RUN mkdir -m 777 /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR /home/appuser/.local |
|
RUN chown -R appuser:appgroup /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR /home/appuser/.local |
|
|
|
|
|
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"] |
|
|