Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -24
Dockerfile
CHANGED
|
@@ -27,34 +27,21 @@
|
|
| 27 |
|
| 28 |
# # 🚀 Start FastAPI using Uvicorn
|
| 29 |
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 30 |
-
|
| 31 |
-
FROM python:3.11
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
WORKDIR /
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
COPY
|
|
|
|
| 38 |
|
| 39 |
-
#
|
| 40 |
-
|
| 41 |
|
| 42 |
-
#
|
| 43 |
-
|
| 44 |
-
# Switch to the "user" user
|
| 45 |
-
USER user
|
| 46 |
|
| 47 |
-
#
|
| 48 |
-
|
| 49 |
-
ENV HOME=/home/user \
|
| 50 |
-
PATH=/home/user/.local/bin:$PATH
|
| 51 |
-
|
| 52 |
-
# Set the working directory to the user's home directory
|
| 53 |
-
WORKDIR $HOME/app
|
| 54 |
-
|
| 55 |
-
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 56 |
-
COPY --chown=user . $HOME/app
|
| 57 |
-
|
| 58 |
-
## Start the FASTAPI App on port 7860
|
| 59 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 60 |
|
|
|
|
| 27 |
|
| 28 |
# # 🚀 Start FastAPI using Uvicorn
|
| 29 |
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 30 |
+
FROM python:3.11-slim
|
|
|
|
| 31 |
|
| 32 |
+
# Set work directory
|
| 33 |
+
WORKDIR /app
|
| 34 |
|
| 35 |
+
# Install dependencies
|
| 36 |
+
COPY requirements.txt .
|
| 37 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 38 |
|
| 39 |
+
# Copy application code
|
| 40 |
+
COPY . .
|
| 41 |
|
| 42 |
+
# Expose the Hugging Face default port
|
| 43 |
+
EXPOSE 7860
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
# Run FastAPI app using uvicorn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 47 |
|