Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +17 -12
Dockerfile
CHANGED
@@ -1,19 +1,24 @@
|
|
1 |
-
#
|
2 |
-
FROM python:3.10-slim
|
|
|
3 |
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
COPY requirements.txt main.py nginx.conf ./
|
5 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
WORKDIR /app
|
10 |
-
COPY --from=builder /app /app
|
11 |
-
COPY nginx.conf /etc/nginx/nginx.conf
|
12 |
|
13 |
-
# Create writable
|
14 |
-
RUN mkdir -p /tmp/nginx
|
15 |
-
|
16 |
|
17 |
EXPOSE 7860
|
18 |
|
19 |
-
|
|
|
|
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;'"]
|