shreyankisiri commited on
Commit
ec4f17e
·
verified ·
1 Parent(s): 1ff8a28

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -19
Dockerfile CHANGED
@@ -1,29 +1,17 @@
1
- # Use the official Python image from Docker Hub
2
  FROM python:3.9-slim
3
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
- # Create a virtual environment in the /app/venv directory
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 dependencies inside the virtual environment
23
  RUN pip install --no-cache-dir -r requirements.txt
24
 
25
- # Expose the port that FastAPI will run on
26
- EXPOSE 8000
27
 
28
- # Command to run the app using Uvicorn
29
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
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"]