Spaces:
Sleeping
Sleeping
Refactor Dockerfile to improve cache directory handling and user permissions
Browse files- Dockerfile +3 -4
Dockerfile
CHANGED
@@ -21,7 +21,6 @@ RUN adduser \
|
|
21 |
--gecos "" \
|
22 |
--home "/nonexistent" \
|
23 |
--shell "/sbin/nologin" \
|
24 |
-
--no-create-home \
|
25 |
--uid "${UID}" \
|
26 |
appuser
|
27 |
|
@@ -35,15 +34,15 @@ ENV TRANSFORMERS_CACHE=$HOME/app/.cache/huggingface/hub
|
|
35 |
WORKDIR $HOME/app
|
36 |
|
37 |
COPY --chown=appuser ./requirements.txt requirements.txt
|
38 |
-
RUN mkdir -p
|
39 |
-
&& chown -R appuser:appuser
|
40 |
|
41 |
# Download dependencies as a separate step to take advantage of Docker's caching.
|
42 |
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
|
43 |
# Leverage a bind mount to requirements.txt to avoid having to copy them into
|
44 |
# into this layer.
|
45 |
RUN python -m pip install --upgrade pip \
|
46 |
-
&&
|
47 |
|
48 |
# Copy the source code into the container.
|
49 |
COPY --chown=appuser . $HOME/app
|
|
|
21 |
--gecos "" \
|
22 |
--home "/nonexistent" \
|
23 |
--shell "/sbin/nologin" \
|
|
|
24 |
--uid "${UID}" \
|
25 |
appuser
|
26 |
|
|
|
34 |
WORKDIR $HOME/app
|
35 |
|
36 |
COPY --chown=appuser ./requirements.txt requirements.txt
|
37 |
+
RUN mkdir -p /app/.cache \
|
38 |
+
&& chown -R appuser:appuser /app/.cache
|
39 |
|
40 |
# Download dependencies as a separate step to take advantage of Docker's caching.
|
41 |
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
|
42 |
# Leverage a bind mount to requirements.txt to avoid having to copy them into
|
43 |
# into this layer.
|
44 |
RUN python -m pip install --upgrade pip \
|
45 |
+
&& pip install -r requirements.txt
|
46 |
|
47 |
# Copy the source code into the container.
|
48 |
COPY --chown=appuser . $HOME/app
|