Spaces:
Build error
Build error
# Stage 1: Build dependencies | |
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 image with unprivileged nginx | |
FROM nginxinc/nginx-unprivileged:1.25-alpine | |
WORKDIR /app | |
COPY --from=builder /app /app | |
COPY nginx.conf /etc/nginx/nginx.conf | |
# Create writable temp directory for nginx | |
RUN mkdir -p /tmp/nginx/client_temp \ | |
&& chmod -R 777 /tmp/nginx | |
EXPOSE 7860 | |
CMD ["sh", "-c", "python -m uvicorn main:app --host 0.0.0.0 --port 8000 & nginx -g 'daemon off;'"] | |