|
FROM python:3.10-slim
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /code
|
|
|
|
|
|
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
|
|
RUN pip install --no-cache-dir --upgrade pip && \
|
|
pip install --no-cache-dir -r /code/requirements.txt
|
|
|
|
|
|
RUN useradd -m user
|
|
USER user
|
|
|
|
|
|
ENV HOME=/home/user \
|
|
PATH=/home/user/.local/bin:$PATH \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR $HOME/app
|
|
|
|
|
|
COPY --chown=user . $HOME/app
|
|
|
|
|
|
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |