Spaces:
Paused
Paused
Update Dockerfile
Browse files- 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
|
| 6 |
WORKDIR /code
|
| 7 |
|
| 8 |
-
# Copy the requirements file into the container
|
| 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 |
-
#
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
# Make port 7860 available
|
| 22 |
-
# Hugging Face Spaces expects apps to listen on this port.
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
#
|
| 27 |
-
#
|
| 28 |
-
|
| 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"]
|
|
|