Spaces:
Sleeping
Sleeping
Commit
·
1423dd9
1
Parent(s):
32131c3
Added docker file for containerization
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python image
|
| 2 |
+
FROM python:3.12-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Create a cache directory with proper permissions
|
| 8 |
+
RUN mkdir -p /data/.cache/huggingface && chmod -R 777 /data
|
| 9 |
+
|
| 10 |
+
# Set environment variables for Hugging Face cache
|
| 11 |
+
ENV HF_HOME=/data/.cache/huggingface
|
| 12 |
+
ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
|
| 13 |
+
ENV HF_DATASETS_CACHE=/data/.cache/huggingface/datasets
|
| 14 |
+
|
| 15 |
+
# Copy code
|
| 16 |
+
COPY . .
|
| 17 |
+
|
| 18 |
+
# Install dependencies
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# Expose the port
|
| 22 |
+
EXPOSE 7860
|
| 23 |
+
|
| 24 |
+
# Run the FastAPI app
|
| 25 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|