memex-in commited on
Commit
8161a0a
·
verified ·
1 Parent(s): 5eae9e0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -14
Dockerfile CHANGED
@@ -1,21 +1,19 @@
1
- FROM nginxinc/nginx-unprivileged:1.25-alpine
 
2
 
3
- WORKDIR /app
4
-
5
- # Copy Python app and config
6
- COPY requirements.txt main.py nginx.conf ./
7
 
8
- # Install Python and Uvicorn
9
- RUN apk add --no-cache python3 py3-pip \
10
- && pip install --no-cache-dir -r requirements.txt
11
 
12
- # Ensure /tmp and subdirs exist for nginx temp files
13
- RUN mkdir -p /tmp/nginx-client-temp \
14
- && mkdir -p /tmp/nginx-proxy-temp \
15
- && mkdir -p /tmp/nginx-fastcgi-temp \
16
- && mkdir -p /tmp/nginx-uwsgi-temp \
17
- && mkdir -p /tmp/nginx-scgi-temp
18
 
19
  EXPOSE 7860
20
 
 
21
  CMD ["sh", "-c", "python3 -m uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"]
 
1
+ # Use nginx:alpine to allow apk installs under root
2
+ FROM nginx:alpine
3
 
4
+ # Install Python + Uvicorn
5
+ RUN apk update \
6
+ && apk add --no-cache python3 py3-pip \
7
+ && pip3 install --no-cache-dir fastapi uvicorn gradio
8
 
9
+ WORKDIR /app
10
+ COPY main.py requirements.txt nginx.conf ./
 
11
 
12
+ # Create temp dirs and adjust permissions
13
+ RUN mkdir -p /tmp/nginx/{client_body_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} \
14
+ && chmod -R 777 /tmp/nginx
 
 
 
15
 
16
  EXPOSE 7860
17
 
18
+ # Run Uvicorn + Nginx together
19
  CMD ["sh", "-c", "python3 -m uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"]