File size: 573 Bytes
bc806d7
34a4d1e
f9050af
 
34a4d1e
 
bc806d7
34a4d1e
bc806d7
34a4d1e
 
f9050af
bc806d7
34a4d1e
bc806d7
f9050af
 
 
bc806d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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;'"]