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