Skip to content

Commit 8519ae3

Browse files
committed
Fix ~/.ivy2 dir ownership
1 parent 37687f1 commit 8519ae3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

docker/Dockerfile.worker

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,15 @@ RUN --mount=type=bind,source=./syncmaster/worker/ivy2.py,target=/app/syncmaster/
7272
# ivy2 keeps file mtime as it was uploaded to Maven
7373
--times \
7474
--omit-dir-times \
75+
--perms \
7576
# ivydata-$version.properties contains download time, avoid copying it to prevent layer cache invalidation
7677
--exclude 'ivydata*.properties' \
7778
# ignored by Spark
7879
--exclude 'ivyreport*' \
7980
# do not copy ~/.ivy2/jars/$group.$artifact.jar, as these are the same files as in ~/.ivy2/cache/$group/$artifact/jars/
8081
/root/.ivy2/cache/ /home/syncmaster/.ivy2/cache/ && \
8182
# # custom Spark session function may download additional jars, so user have to own them, but not jars
82-
find /home/syncmaster/.ivy2/ -type d -exec chmod 777 {} \; && \
83-
# reset directory timestamps
84-
find /home/syncmaster/.ivy2/ -type d -exec touch -d @0 {} \;
85-
86-
RUN mkdir -p /root && ln -s /home/syncmaster/.ivy2 /root/.ivy2
83+
find /home/syncmaster/.ivy2 -type d -exec chown syncmaster:syncmaster {} \;
8784

8885

8986
FROM base AS prod
@@ -92,7 +89,7 @@ FROM base AS prod
9289
COPY --link --from=builder /app/.venv/ /app/.venv/
9390

9491
# using --link to make ~/.ivy2 a separated layer in docker image, not based on previous layers
95-
COPY --link --from=ivy2_packages /home/syncmaster/.ivy2/cache/ /home/syncmaster/.ivy2/cache/
92+
COPY --link --from=ivy2_packages /home/syncmaster/.ivy2/ /home/syncmaster/.ivy2/
9693
# If someone needs to use worker image with root user, use the same jars
9794
RUN mkdir -p /root && ln -s /home/syncmaster/.ivy2 /root/.ivy2
9895

@@ -107,6 +104,7 @@ USER syncmaster
107104

108105
FROM ivy2_packages AS test
109106

107+
RUN mkdir -p /root && ln -s /home/syncmaster/.ivy2 /root/.ivy2
110108
RUN --mount=type=cache,target=/root/.cache/uv \
111109
uv sync \
112110
--frozen \

0 commit comments

Comments
 (0)