Update Dockerfile
Browse files- Dockerfile +35 -34
Dockerfile
CHANGED
|
@@ -1,34 +1,35 @@
|
|
| 1 |
-
# Use an official Python runtime as a parent image
|
| 2 |
-
FROM python:3.10-slim
|
| 3 |
-
|
| 4 |
-
# Set environment variables
|
| 5 |
-
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
-
ENV PYTHONUNBUFFERED 1
|
| 7 |
-
ENV HF_HOME=/tmp/huggingface
|
| 8 |
-
|
| 9 |
-
# Set the working directory in the container
|
| 10 |
-
WORKDIR /app
|
| 11 |
-
|
| 12 |
-
# Install system dependencies for OpenCV and other tools
|
| 13 |
-
RUN apt-get update && apt-get install -y \
|
| 14 |
-
libgl1 \
|
| 15 |
-
libglib2.0-0 \
|
| 16 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
-
|
| 18 |
-
# Copy the requirements file into the container
|
| 19 |
-
COPY requirements.txt .
|
| 20 |
-
|
| 21 |
-
# Install dependencies
|
| 22 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
-
|
| 24 |
-
# Copy the rest of the application code
|
| 25 |
-
COPY . .
|
| 26 |
-
|
| 27 |
-
# Create necessary directories and set permissions for HF Spaces
|
| 28 |
-
RUN mkdir -p uploads results encoder && chmod -R 777 uploads results encoder
|
| 29 |
-
|
| 30 |
-
# Expose the target port
|
| 31 |
-
EXPOSE 7860
|
| 32 |
-
|
| 33 |
-
# Run the application with Gunicorn
|
| 34 |
-
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
+
ENV PYTHONUNBUFFERED 1
|
| 7 |
+
ENV HF_HOME=/tmp/huggingface
|
| 8 |
+
|
| 9 |
+
# Set the working directory in the container
|
| 10 |
+
WORKDIR /app
|
| 11 |
+
|
| 12 |
+
# Install system dependencies for OpenCV and other tools
|
| 13 |
+
RUN apt-get update && apt-get install -y \
|
| 14 |
+
libgl1 \
|
| 15 |
+
libglib2.0-0 \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
# Copy the requirements file into the container
|
| 19 |
+
COPY requirements.txt .
|
| 20 |
+
|
| 21 |
+
# Install dependencies
|
| 22 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
+
|
| 24 |
+
# Copy the rest of the application code
|
| 25 |
+
COPY . .
|
| 26 |
+
|
| 27 |
+
# Create necessary directories and set permissions for HF Spaces
|
| 28 |
+
RUN mkdir -p uploads results encoder && chmod -R 777 uploads results encoder
|
| 29 |
+
|
| 30 |
+
# Expose the target port
|
| 31 |
+
EXPOSE 7860
|
| 32 |
+
|
| 33 |
+
# Run the application with Gunicorn
|
| 34 |
+
# Timeout is set to 0 to disable it, allowing long-running inference tasks
|
| 35 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "0", "app:app"]
|