memex-in commited on
Commit
bc806d7
·
verified ·
1 Parent(s): a07987e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -5
Dockerfile CHANGED
@@ -1,18 +1,19 @@
1
- # Stage 1: build dependencies and code
2
  FROM python:3.10-slim AS builder
3
  WORKDIR /app
4
  COPY requirements.txt main.py nginx.conf ./
5
  RUN pip install --no-cache-dir -r requirements.txt
6
 
7
- # Stage 2: runtime with unprivileged nginx
8
  FROM nginxinc/nginx-unprivileged:1.25-alpine
 
9
  COPY --from=builder /app /app
10
  COPY nginx.conf /etc/nginx/nginx.conf
11
 
12
- # Prepare Nginx temp dirs
13
  RUN mkdir -p /tmp/nginx/client_temp \
14
- && chown -R nginx:nginx /tmp/nginx
15
 
16
  EXPOSE 7860
17
 
18
- CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port 8000 & nginx -g 'daemon off;'"]
 
1
+ # Stage 1: Build dependencies
2
  FROM python:3.10-slim AS builder
3
  WORKDIR /app
4
  COPY requirements.txt main.py nginx.conf ./
5
  RUN pip install --no-cache-dir -r requirements.txt
6
 
7
+ # Stage 2: Runtime image with unprivileged nginx
8
  FROM nginxinc/nginx-unprivileged:1.25-alpine
9
+ WORKDIR /app
10
  COPY --from=builder /app /app
11
  COPY nginx.conf /etc/nginx/nginx.conf
12
 
13
+ # Create writable temp directory for nginx
14
  RUN mkdir -p /tmp/nginx/client_temp \
15
+ && chmod -R 777 /tmp/nginx
16
 
17
  EXPOSE 7860
18
 
19
+ CMD ["sh", "-c", "python -m uvicorn main:app --host 0.0.0.0 --port 8000 & nginx -g 'daemon off;'"]