ariG23498 HF staff commited on
Commit
c2ad539
·
verified ·
1 Parent(s): 3917b67

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.12 as the base image
2
+ FROM python:3.12
3
+
4
+ # Install system dependencies
5
+ RUN apt-get update && apt-get install -y \
6
+ ffmpeg \
7
+ git \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Create a non-root user
11
+ RUN useradd -m -u 1000 user
12
+ WORKDIR /app
13
+
14
+ # Copy requirements file
15
+ COPY --chown=user ./requirements.txt requirements.txt
16
+
17
+ # Install dependencies from source
18
+ RUN pip install --no-cache-dir --upgrade pip && \
19
+ pip install --no-cache-dir git+https://github.com/huggingface/transformers && \
20
+ pip install --no-cache-dir flash-attn && \
21
+ pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Copy application files
24
+ COPY --chown=user . /app
25
+
26
+ # Switch to the non-root user
27
+ USER user
28
+
29
+ # Set environment variables
30
+ ENV HOME=/home/user \
31
+ PATH=/home/user/.local/bin:$PATH
32
+
33
+ # Command to run the application
34
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]