Spaces:
Running
on
A100
Running
on
A100
AurelioAguirre
commited on
Commit
·
a2b3d9e
1
Parent(s):
cdba123
New Docker
Browse files- Dockerfile +25 -13
Dockerfile
CHANGED
@@ -1,20 +1,32 @@
|
|
1 |
-
|
2 |
-
# you will also find guides on how best to write your Dockerfile
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
#
|
7 |
-
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
|
8 |
RUN useradd -m -u 1000 user
|
9 |
-
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
COPY --chown=user
|
|
|
|
|
|
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10-slim
|
|
|
2 |
|
3 |
+
# Install system dependencies
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
bash \
|
6 |
+
wget \
|
7 |
+
git \
|
8 |
+
git-lfs \
|
9 |
+
&& rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
+
# Set up user properly
|
|
|
12 |
RUN useradd -m -u 1000 user
|
13 |
+
ENV HOME=/home/user \
|
14 |
+
PATH=/home/user/.local/bin:$PATH
|
15 |
|
16 |
+
# Set working directory in user's home
|
17 |
+
WORKDIR $HOME/app
|
18 |
|
19 |
+
# Copy requirements and install as user
|
20 |
+
COPY --chown=user requirements.txt .
|
21 |
+
USER user
|
22 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
23 |
+
pip install --no-cache-dir -r requirements.txt
|
24 |
|
25 |
+
# Copy application code
|
26 |
+
COPY --chown=user . $HOME/app
|
27 |
|
28 |
+
# Make sure port matches the one in your code
|
29 |
+
EXPOSE 8001
|
30 |
+
|
31 |
+
# Use uvicorn directly with specific settings
|
32 |
+
CMD ["uvicorn", "main.app:app", "--host", "0.0.0.0", "--port", "8001", "--workers", "1", "--reload", "false"]
|