Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +19 -11
Dockerfile
CHANGED
@@ -1,19 +1,27 @@
|
|
1 |
-
|
2 |
-
FROM nginx:alpine
|
3 |
|
4 |
-
# Install
|
5 |
-
RUN apk
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
RUN mkdir -p /tmp/nginx/{client_body_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} \
|
14 |
-
|
15 |
|
16 |
EXPOSE 7860
|
17 |
|
18 |
-
|
19 |
-
CMD ["sh", "-c", "python3 -m uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"]
|
|
|
1 |
+
FROM alpine:latest
|
|
|
2 |
|
3 |
+
# Install Python3 and venv tools
|
4 |
+
RUN apk add --no-cache python3 py3-venv build-base
|
|
|
|
|
5 |
|
6 |
WORKDIR /app
|
|
|
7 |
|
8 |
+
# Create a virtual environment and prepend it to PATH
|
9 |
+
RUN python3 -m venv /venv
|
10 |
+
ENV PATH="/venv/bin:$PATH"
|
11 |
+
|
12 |
+
# Copy project files
|
13 |
+
COPY requirements.txt main.py nginx.conf ./
|
14 |
+
|
15 |
+
# Install dependencies into the venv
|
16 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
17 |
+
|
18 |
+
# Install nginx to proxy (needed for fast forwarding)
|
19 |
+
RUN apk add --no-cache nginx
|
20 |
+
|
21 |
+
# Set up writable temp dirs for nginx
|
22 |
RUN mkdir -p /tmp/nginx/{client_body_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} \
|
23 |
+
&& chmod -R 777 /tmp/nginx
|
24 |
|
25 |
EXPOSE 7860
|
26 |
|
27 |
+
CMD ["sh", "-c", "uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"]
|
|