Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /code
|
| 6 |
+
|
| 7 |
+
# Copy the requirements file into the container at /code
|
| 8 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
+
|
| 10 |
+
# Install any needed packages specified in requirements.txt
|
| 11 |
+
# --no-cache-dir: Disables the cache to keep the image size smaller
|
| 12 |
+
# --upgrade: Ensures pip is up to date
|
| 13 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 14 |
+
|
| 15 |
+
# Copy the rest of the application's code into the container at /code
|
| 16 |
+
COPY . /code
|
| 17 |
+
|
| 18 |
+
# Expose the port the app will run on. Hugging Face Spaces uses 7860.
|
| 19 |
+
EXPOSE 7860
|
| 20 |
+
|
| 21 |
+
# Command to run the app when the container launches.
|
| 22 |
+
# Uvicorn is the server that runs our FastAPI app.
|
| 23 |
+
# --host 0.0.0.0 makes the app accessible from outside the container.
|
| 24 |
+
# --port 7860 matches the exposed port.
|
| 25 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|