|
|
| FROM python:3.9-slim
|
|
|
|
|
| RUN useradd -m -u 1000 user
|
|
|
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \
|
| build-essential \
|
| && apt-get clean \
|
| && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
| USER user
|
|
|
|
|
| ENV HOME=/home/user \
|
| PATH=/home/user/.local/bin:$PATH
|
|
|
|
|
| WORKDIR $HOME/app
|
|
|
|
|
| COPY --chown=user requirements.txt .
|
|
|
|
|
| RUN pip install --no-cache-dir --upgrade pip && \
|
| pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
| COPY --chown=user . .
|
|
|
|
|
| USER root
|
| RUN chmod +x entrypoint.sh
|
| USER user
|
|
|
|
|
| EXPOSE 7860
|
|
|
|
|
| CMD ["./entrypoint.sh"] |