memex-in commited on
Commit
ddd3775
·
verified ·
1 Parent(s): 85034ff

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -15
Dockerfile CHANGED
@@ -1,24 +1,21 @@
1
- # Single-stage build: Python + Nginx combined
2
- FROM python:3.10-slim
3
 
4
  WORKDIR /app
5
 
6
- # Install Nginx from Debian repo
7
- RUN apt-get update && \
8
- apt-get install -y nginx && \
9
- rm -rf /var/lib/apt/lists/*
10
-
11
- # Copy app, requirements, and config
12
  COPY requirements.txt main.py nginx.conf ./
13
 
14
- # Install Python dependencies
15
- RUN pip install --no-cache-dir -r requirements.txt
 
16
 
17
- # Create writable tmp dirs for nginx
18
- RUN mkdir -p /tmp/nginx && \
19
- chown -R www-data:www-data /tmp/nginx
 
 
 
20
 
21
  EXPOSE 7860
22
 
23
- # Start Uvicorn and Nginx together
24
- CMD ["sh", "-c", "python -m uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"]
 
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;'"]