singhankur01 commited on
Commit
649a4d5
·
verified ·
1 Parent(s): df8dfa4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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
- ## Use the official Python 3.9 image
31
- FROM python:3.11
32
 
33
- ## set the working directory to /code
34
- WORKDIR /code
35
 
36
- ## Copy the current directory contents in the container at /code
37
- COPY ./requirements.txt /code/requirements.txt
 
38
 
39
- ## Install the requirements.txt
40
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
41
 
42
- # Set up a new user named "user"
43
- RUN useradd user
44
- # Switch to the "user" user
45
- USER user
46
 
47
- # Set home to the user's home directory
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