Spaces:
Paused
Paused
CBV01 commited on
Commit ·
b4b3424
1
Parent(s): 9e497a6
add Dockerfile for HF
Browse files- Dockerfile +22 -0
Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
# Create a non-root user
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
USER user
|
| 6 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
+
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
# Copy only the backend requirements first for caching
|
| 11 |
+
COPY --chown=user backend/requirements.txt requirements.txt
|
| 12 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 13 |
+
|
| 14 |
+
# Copy the entire backend folder content to the container root /app
|
| 15 |
+
COPY --chown=user backend/ .
|
| 16 |
+
|
| 17 |
+
# Hugging Face requires port 7860
|
| 18 |
+
ENV PORT=7860
|
| 19 |
+
EXPOSE 7860
|
| 20 |
+
|
| 21 |
+
# Run the app. Note: main:app refers to main.py inside the backend folder
|
| 22 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|