Spaces:
Sleeping
Sleeping
wjm55
commited on
Commit
·
df9c057
1
Parent(s):
91da5d0
Optimize Dockerfile: Reorder COPY commands to improve caching and ensure proper file ownership for application files
Browse files- Dockerfile +4 -2
Dockerfile
CHANGED
@@ -1,7 +1,6 @@
|
|
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 |
-
|
5 |
FROM python:3.10
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
@@ -9,8 +8,11 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
9 |
|
10 |
WORKDIR /app
|
11 |
|
|
|
|
|
12 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
13 |
|
14 |
-
|
15 |
COPY --chown=user . /app
|
|
|
16 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
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.10
|
5 |
RUN useradd -m -u 1000 user
|
6 |
USER user
|
|
|
8 |
|
9 |
WORKDIR /app
|
10 |
|
11 |
+
# Copy requirements first to leverage Docker cache
|
12 |
+
COPY --chown=user requirements.txt /app/
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
|
15 |
+
# Copy the rest of the application
|
16 |
COPY --chown=user . /app
|
17 |
+
|
18 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|