Create Dockerfile
Browse files- Dockerfile +23 -0
Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Start from a standard Python image (3.10 is robust and common)
|
| 2 |
+
FROM python:3.10
|
| 3 |
+
|
| 4 |
+
# Set the working directory inside the container
|
| 5 |
+
# All subsequent commands will run from here
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
|
| 8 |
+
# Copy the requirements file and install the necessary dependencies
|
| 9 |
+
# The RUN command executes the installation of PyTorch, Transformers, and FastAPI
|
| 10 |
+
COPY requirements.txt .
|
| 11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# Copy the main application code
|
| 14 |
+
COPY main.py .
|
| 15 |
+
|
| 16 |
+
# Expose the port the application will run on
|
| 17 |
+
# Hugging Face Spaces requires port 7860 for custom apps
|
| 18 |
+
EXPOSE 7860
|
| 19 |
+
|
| 20 |
+
# Define the command to run the Uvicorn server (which hosts FastAPI)
|
| 21 |
+
# It tells the container to start the 'app' object inside 'main.py'
|
| 22 |
+
# and listen on port 7860
|
| 23 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|