Update Dockerfile
Browse files- Dockerfile +9 -15
Dockerfile
CHANGED
|
@@ -1,24 +1,18 @@
|
|
| 1 |
# Use an official Python runtime as a base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
# If no requirements.txt is provided, install the required packages directly.
|
| 9 |
-
COPY requirements.txt ./
|
| 10 |
-
|
| 11 |
-
RUN if [ -f requirements.txt ]; then \
|
| 12 |
-
pip install --upgrade pip && \
|
| 13 |
-
pip install -r requirements.txt; \
|
| 14 |
-
else \
|
| 15 |
-
pip install --upgrade pip && \
|
| 16 |
-
pip install fastapi uvicorn[standard] jinja2; \
|
| 17 |
-
fi
|
| 18 |
-
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
|
|
|
|
|
|
| 1 |
# Use an official Python runtime as a base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy the entire project into the container
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
COPY . .
|
| 9 |
|
| 10 |
+
# Install FastAPI, Uvicorn (with standard extras), and Jinja2
|
| 11 |
+
RUN pip install --upgrade pip && \
|
| 12 |
+
pip install fastapi uvicorn[standard] jinja2
|
| 13 |
|
| 14 |
+
# Expose the default port for HuggingFace Spaces
|
| 15 |
+
EXPOSE 7860
|
| 16 |
|
| 17 |
+
# Run the app on port 7860
|
| 18 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|