ANANNYAVYAS commited on
Commit
cf8c7b0
·
verified ·
1 Parent(s): 358ec79

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +45 -0
Dockerfile ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.11 as the base image
2
+ FROM python:3.11-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE 1
6
+ ENV PYTHONUNBUFFERED 1
7
+ ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
+
10
+ # Create a user to match Hugging Face's requirements
11
+ RUN useradd -m -u 1000 user
12
+
13
+ # Set working directory
14
+ WORKDIR /app
15
+
16
+ # Install system dependencies for OpenCV and curl
17
+ RUN apt-get update && apt-get install -y \
18
+ libgl1 \
19
+ libglib2.0-0 \
20
+ curl \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Copy requirements and install dependencies
24
+ COPY --chown=user requirements.txt .
25
+ RUN pip install --no-cache-dir --user -r requirements.txt
26
+
27
+ # Create Model directory and set permissions
28
+ RUN mkdir -p Model && chown -R user:user /app
29
+
30
+ # Switch to the non-root user
31
+ USER user
32
+
33
+ # PRE-DOWNLOAD THE MODEL (This makes startup instant!)
34
+ RUN curl -L -o Model/colorization_deploy_v2.prototxt https://storage.openvinotoolkit.org/repositories/datumaro/models/colorization/colorization_deploy_v2.prototxt && \
35
+ curl -L -o Model/colorization_release_v2.caffemodel https://storage.openvinotoolkit.org/repositories/datumaro/models/colorization/colorization_release_v2.caffemodel && \
36
+ curl -L -o Model/pts_in_hull.npy https://storage.openvinotoolkit.org/repositories/datumaro/models/colorization/pts_in_hull.npy
37
+
38
+ # Copy the rest of the application code
39
+ COPY --chown=user . .
40
+
41
+ # Expose the Hugging Face standard port
42
+ EXPOSE 7860
43
+
44
+ # Start the application using Gunicorn on port 7860
45
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app", "--timeout", "120"]