Create Dockerfile
Browse files- Dockerfile +22 -0
Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Python image
|
| 2 |
+
FROM python:3.9
|
| 3 |
+
|
| 4 |
+
# Set the working directory
|
| 5 |
+
WORKDIR /code
|
| 6 |
+
|
| 7 |
+
# Copy the requirements file
|
| 8 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
+
|
| 10 |
+
# Install the dependencies
|
| 11 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 12 |
+
|
| 13 |
+
# Copy the application code
|
| 14 |
+
COPY ./app.py /code/app.py
|
| 15 |
+
|
| 16 |
+
# Create a writable cache directory (FastAPI/Uvicorn needs this sometimes)
|
| 17 |
+
RUN mkdir -p /code/cache
|
| 18 |
+
RUN chmod 777 /code/cache
|
| 19 |
+
ENV XDG_CACHE_HOME=/code/cache
|
| 20 |
+
|
| 21 |
+
# Start the application on port 7860 (Hugging Face's default port)
|
| 22 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|