kingkill1111 commited on
Commit
dd2eba1
·
verified ·
1 Parent(s): 8d937f1

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python base image
2
+ FROM python:3.10-slim
3
+
4
+ # Install system dependencies required for OpenCV
5
+ RUN apt-get update && apt-get install -y \
6
+ libgl1-mesa-glx \
7
+ libglib2.0-0 \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Hugging Face requires a non-root user with ID 1000
11
+ RUN useradd -m -u 1000 user
12
+ USER user
13
+ ENV HOME=/home/user \
14
+ PATH=/home/user/.local/bin:$PATH \
15
+ PYTHONUNBUFFERED=1
16
+
17
+ # Set the working directory
18
+ WORKDIR $HOME/app
19
+
20
+ # Copy requirements and install
21
+ COPY --chown=user requirements.txt .
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy your application code
25
+ COPY --chown=user . .
26
+
27
+ # Expose port 7860 (Hugging Face default)
28
+ EXPOSE 7860
29
+
30
+ # Command to start the FastAPI server
31
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]