OmarAbualrob commited on
Commit
ff4685d
·
verified ·
1 Parent(s): 422b71e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -16
Dockerfile CHANGED
@@ -1,29 +1,23 @@
1
  # Use an official Python runtime as a parent image.
2
- # Using python:3.9-slim is a good balance of features and image size.
3
  FROM python:3.9-slim
4
 
5
- # Set the working directory inside the container to /code
6
  WORKDIR /code
7
 
8
- # Copy the requirements file into the container at /code
9
- # This is done first to leverage Docker's layer caching.
10
- # The expensive pip install step will only be re-run if requirements.txt changes.
11
  COPY ./requirements.txt /code/requirements.txt
12
 
13
  # Install any needed packages specified in requirements.txt
14
- # --no-cache-dir: Disables the cache to keep the image size smaller.
15
- # --upgrade: Ensures we get the latest specified versions.
16
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
17
 
18
- # Copy the rest of the application code (the 'app' directory) into the container at /code
19
- COPY ./app /code/app
 
20
 
21
- # Make port 7860 available to the world outside this container.
22
- # Hugging Face Spaces expects apps to listen on this port.
23
  EXPOSE 7860
24
 
25
- # Define the command to run your app using uvicorn.
26
- # This tells uvicorn to run the 'app' object from the 'app.main' module.
27
- # --host 0.0.0.0: Makes the server accessible from outside the container.
28
- # --port 7860: The port to listen on.
29
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Use an official Python runtime as a parent image.
 
2
  FROM python:3.9-slim
3
 
4
+ # Set the working directory inside the container
5
  WORKDIR /code
6
 
7
+ # Copy the requirements file into the container
 
 
8
  COPY ./requirements.txt /code/requirements.txt
9
 
10
  # Install any needed packages specified in requirements.txt
 
 
11
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
 
13
+ # --- CHANGE IS HERE ---
14
+ # Copy your app.py file directly into the container's working directory
15
+ COPY ./app.py /code/app.py
16
 
17
+ # Make port 7860 available
 
18
  EXPOSE 7860
19
 
20
+ # --- AND CHANGE IS HERE ---
21
+ # Command to run your app.
22
+ # "app:app" means: "Look for a file named app.py, and inside it, find the object named app".
23
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]