Spaces:
Build error
Build error
# Stage 1: build dependencies and code | |
FROM python:3.10-slim AS builder | |
WORKDIR /app | |
COPY requirements.txt main.py nginx.conf ./ | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Stage 2: runtime with unprivileged nginx | |
FROM nginxinc/nginx-unprivileged:1.25-alpine | |
COPY --from=builder /app /app | |
COPY nginx.conf /etc/nginx/nginx.conf | |
# Prepare Nginx temp dirs | |
RUN mkdir -p /tmp/nginx/client_temp \ | |
&& chown -R nginx:nginx /tmp/nginx | |
EXPOSE 7860 | |
CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port 8000 & nginx -g 'daemon off;'"] | |