Spaces:
Sleeping
Sleeping
Commit
·
da0eae8
1
Parent(s):
43f12ff
commit
Browse files- Dockerfile +12 -3
Dockerfile
CHANGED
@@ -1,15 +1,24 @@
|
|
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.12.3
|
5 |
|
|
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
9 |
|
10 |
WORKDIR /app
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
|
14 |
COPY --chown=user . /app
|
|
|
|
|
15 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
1 |
FROM python:3.12.3
|
2 |
|
3 |
+
# Create a user and switch to it
|
4 |
RUN useradd -m -u 1000 user
|
5 |
USER user
|
6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
7 |
|
8 |
WORKDIR /app
|
9 |
|
10 |
+
# Copy and install Debian dependencies from packages.txt
|
11 |
+
COPY --chown=user ./packages.txt packages.txt
|
12 |
+
USER root
|
13 |
+
RUN apt-get update && xargs -a packages.txt apt-get install -y --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
14 |
+
USER user
|
15 |
+
|
16 |
+
# Copy and install Python dependencies
|
17 |
COPY --chown=user ./requirements.txt requirements.txt
|
18 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
19 |
+
|
20 |
+
# Copy application code
|
21 |
COPY --chown=user . /app
|
22 |
+
|
23 |
+
# Run the application
|
24 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|