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