Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +14 -2
Dockerfile
CHANGED
|
@@ -1,13 +1,25 @@
|
|
| 1 |
FROM python:3.9
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /code
|
| 4 |
|
|
|
|
| 5 |
COPY ./requirements.txt /code/requirements.txt
|
| 6 |
|
| 7 |
-
|
|
|
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 10 |
|
|
|
|
| 11 |
COPY . .
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
| 1 |
FROM python:3.9
|
| 2 |
|
| 3 |
+
# Create and set the working directory
|
| 4 |
WORKDIR /code
|
| 5 |
|
| 6 |
+
# Copy the requirements file
|
| 7 |
COPY ./requirements.txt /code/requirements.txt
|
| 8 |
|
| 9 |
+
# Install the virtualenv package
|
| 10 |
+
RUN pip install --no-cache-dir virtualenv
|
| 11 |
|
| 12 |
+
# Create a virtual environment
|
| 13 |
+
RUN python -m virtualenv venv
|
| 14 |
+
|
| 15 |
+
# Use the virtual environment
|
| 16 |
+
ENV PATH="/code/venv/bin:$PATH"
|
| 17 |
+
|
| 18 |
+
# Install dependencies in the virtual environment
|
| 19 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 20 |
|
| 21 |
+
# Copy the rest of the application code
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
+
# Run the application using the virtual environment's Python
|
| 25 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|