Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +12 -2
Dockerfile
CHANGED
|
@@ -1,11 +1,21 @@
|
|
| 1 |
-
FROM python:3.10
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
| 7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 8 |
|
|
|
|
| 9 |
COPY . .
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
FROM python:3.10-alpine
|
| 2 |
|
| 3 |
+
# Set working directory
|
| 4 |
WORKDIR /code
|
| 5 |
|
| 6 |
+
# Install build dependencies first (because Alpine is minimal)
|
| 7 |
+
RUN apk add --no-cache --virtual .build-deps \
|
| 8 |
+
gcc musl-dev libffi-dev make
|
| 9 |
|
| 10 |
+
# Install Python dependencies
|
| 11 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 12 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 13 |
|
| 14 |
+
# Copy app files
|
| 15 |
COPY . .
|
| 16 |
|
| 17 |
+
# Remove build dependencies to make final image lighter
|
| 18 |
+
RUN apk del .build-deps
|
| 19 |
+
|
| 20 |
+
# Command to run your app
|
| 21 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|