Spaces:
Sleeping
Sleeping
FROM python:3.11.11-slim AS build | |
ENV PIP_DEFAULT_TIMEOUT=100 \ | |
PYTHONUNBUFFERED=1 \ | |
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
PIP_NO_CACHE_DIR=1 | |
WORKDIR /app | |
COPY requirements.txt . | |
RUN pip install --upgrade pip && pip wheel --no-cache-dir --wheel-dir /wheels -r requirements.txt | |
FROM python:3.11.11-slim AS final | |
ENV PATH="/home/appuser/.local/bin:$PATH" | |
RUN set -ex \ | |
&& addgroup --system --gid 1001 appgroup \ | |
&& adduser --system --uid 1001 --gid 1001 --home /home/appuser appuser \ | |
&& apt-get update \ | |
&& apt-get upgrade -y \ | |
&& apt-get install -y libjpeg-dev zlib1g-dev \ | |
&& apt-get autoremove -y \ | |
&& apt-get clean -y \ | |
&& rm -rf /var/lib/apt/lists/* | |
WORKDIR /app | |
COPY --from=build /wheels /wheels | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir --no-warn-script-location --no-index --find-links=/wheels -r requirements.txt | |
COPY . . | |
USER appuser | |
EXPOSE 7860 | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |