d-e-e-k-11 commited on
Commit
8314051
·
verified ·
1 Parent(s): 7ec4953

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.10-slim
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ libgl1-mesa-glx \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy the requirements file into the container
14
+ COPY requirements.txt .
15
+
16
+ # Install any needed packages specified in requirements.txt
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the application code and model
20
+ COPY web_app/ .
21
+
22
+ # Create uploads directory
23
+ RUN mkdir -p uploads && chmod 777 uploads
24
+
25
+ # Create a non-root user and switch to it (Hugging Face Recommended)
26
+ RUN useradd -m -u 1000 user
27
+ USER user
28
+ ENV HOME=/home/user \
29
+ PATH=/home/user/.local/bin:$PATH
30
+
31
+ # Expose port 7860 (Hugging Face default)
32
+ EXPOSE 7860
33
+
34
+ # Command to run the application using gunicorn
35
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "server:app"]