Spaces:
Running
Running
biotechtamilan
commited on
Create Dockerfile
Browse files- Dockerfile +36 -0
Dockerfile
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# Install Python dependencies directly
|
15 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
16 |
+
pip install --no-cache-dir \
|
17 |
+
torch \
|
18 |
+
torchvision \
|
19 |
+
git+https://github.com/huggingface/transformers \
|
20 |
+
accelerate \
|
21 |
+
qwen-vl-utils[decord]==0.0.8 \
|
22 |
+
fastapi \
|
23 |
+
uvicorn[standard]
|
24 |
+
|
25 |
+
# Copy application files
|
26 |
+
COPY --chown=user . /app
|
27 |
+
|
28 |
+
# Switch to the non-root user
|
29 |
+
USER user
|
30 |
+
|
31 |
+
# Set environment variables
|
32 |
+
ENV HOME=/home/user \
|
33 |
+
PATH=/home/user/.local/bin:$PATH
|
34 |
+
|
35 |
+
# Command to run the application
|
36 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|