Update Dockerfile
Browse files- Dockerfile +14 -4
Dockerfile
CHANGED
|
@@ -2,22 +2,32 @@ FROM python:3.10-slim
|
|
| 2 |
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
-
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
libgomp1 \
|
|
|
|
|
|
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
|
|
|
| 10 |
COPY requirements.txt /code/requirements.txt
|
| 11 |
|
| 12 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 13 |
pip install --no-cache-dir -r /code/requirements.txt
|
| 14 |
|
|
|
|
| 15 |
COPY app.py /code/app.py
|
| 16 |
|
| 17 |
-
# Create
|
| 18 |
-
RUN mkdir -p /tmp/huggingface
|
| 19 |
|
| 20 |
-
# Expose
|
| 21 |
EXPOSE 7860
|
| 22 |
|
|
|
|
| 23 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
+
# Install system dependencies for OpenCV
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
libglib2.0-0 \
|
| 8 |
+
libsm6 \
|
| 9 |
+
libxext6 \
|
| 10 |
+
libxrender-dev \
|
| 11 |
libgomp1 \
|
| 12 |
+
libxcb1 \
|
| 13 |
+
libxcb-shm0 \
|
| 14 |
+
libxcb-render0 \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
+
# Copy and install Python dependencies
|
| 18 |
COPY requirements.txt /code/requirements.txt
|
| 19 |
|
| 20 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 21 |
pip install --no-cache-dir -r /code/requirements.txt
|
| 22 |
|
| 23 |
+
# Copy application code
|
| 24 |
COPY app.py /code/app.py
|
| 25 |
|
| 26 |
+
# Create cache directory for HuggingFace Hub
|
| 27 |
+
RUN mkdir -p /tmp/huggingface && chmod 777 /tmp/huggingface
|
| 28 |
|
| 29 |
+
# Expose HuggingFace Spaces default port
|
| 30 |
EXPOSE 7860
|
| 31 |
|
| 32 |
+
# Start the FastAPI server
|
| 33 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|