Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +7 -19
Dockerfile
CHANGED
|
@@ -1,29 +1,17 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN python -m venv /app/venv
|
| 9 |
-
|
| 10 |
-
# Ensure that the virtual environment is used
|
| 11 |
-
ENV PATH="/app/venv/bin:$PATH"
|
| 12 |
-
|
| 13 |
-
# Set the cache folder to a writable directory
|
| 14 |
-
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
| 15 |
-
|
| 16 |
-
# Create the cache directory and set appropriate permissions
|
| 17 |
-
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache/huggingface
|
| 18 |
-
|
| 19 |
-
# Copy your application files to the container's working directory
|
| 20 |
COPY . /app
|
| 21 |
|
| 22 |
-
# Install
|
| 23 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
-
# Expose
|
| 26 |
-
EXPOSE
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
CMD ["uvicorn", "
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy the current directory contents into the container at /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
COPY . /app
|
| 9 |
|
| 10 |
+
# Install any needed packages specified in requirements.txt
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
+
# Expose port 7860 (default port for Hugging Face Spaces)
|
| 14 |
+
EXPOSE 7860
|
| 15 |
|
| 16 |
+
# Run the FastAPI app with Uvicorn
|
| 17 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|