habulaj commited on
Commit
258ac41
·
verified ·
1 Parent(s): aa6da07

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.9-slim
5
+
6
+ # Create user
7
+ RUN useradd -m -u 1000 user
8
+ USER user
9
+ ENV PATH="/home/user/.local/bin:$PATH"
10
+
11
+ # Set working directory
12
+ WORKDIR /app
13
+
14
+ # Install system dependencies (as root)
15
+ USER root
16
+ RUN apt-get update && apt-get install -y \
17
+ build-essential \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Switch back to user
21
+ USER user
22
+
23
+ # Copy requirements and install Python dependencies
24
+ COPY --chown=user ./requirements.txt requirements.txt
25
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
26
+
27
+ # Copy application code
28
+ COPY --chown=user . /app
29
+
30
+ # Expose port
31
+ EXPOSE 7860
32
+
33
+ # Run the application
34
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]