File size: 754 Bytes
f3a69cd
85034ff
e5f964a
 
 
 
34a4d1e
8161a0a
f9050af
e5f964a
f3a69cd
 
 
e5f964a
f3a69cd
 
 
e5f964a
8161a0a
f3a69cd
f9050af
 
 
e5f964a
f3a69cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
FROM alpine:latest

# Install Python, pip, and venv support
RUN apk update && \
    apk add --no-cache python3 py3-pip python3-venv build-base nginx && \
    ln -sf python3 /usr/bin/python

WORKDIR /app

# Create and enable virtual environment
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"

# Copy code and install Python dependencies into venv
COPY requirements.txt main.py nginx.conf ./
RUN pip install --no-cache-dir -r requirements.txt

# Create writable temp dirs for nginx
RUN mkdir -p /tmp/nginx/{client_body_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} \
    && chmod -R 777 /tmp/nginx

EXPOSE 7860

# Launch both FastAPI (uvicorn) and nginx
CMD ["sh", "-c", "uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"]