From 67ed4a02456205efd7c6ff257ca8781f1409553a Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Nov 2023 12:34:09 +1100 Subject: [PATCH] Respect CONTAINER_UID in Dockerfile chown CONTAINER_UID is used for the user ID within the container, however I noticed the UID was hard coded to 1000 in the Dockerfile chown -R command. This leaves the default as 1000, but allows it to be overrriden by setting CONTAINER_UID. --- docker/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6aa6a43a1a..90d0b4b715 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -100,6 +100,7 @@ ENV INVOKEAI_SRC=/opt/invokeai ENV VIRTUAL_ENV=/opt/venv/invokeai ENV INVOKEAI_ROOT=/invokeai ENV PATH="$VIRTUAL_ENV/bin:$INVOKEAI_SRC:$PATH" +ENV CONTAINER_UID=${CONTAINER_UID:-1000} # --link requires buldkit w/ dockerfile syntax 1.4 COPY --link --from=builder ${INVOKEAI_SRC} ${INVOKEAI_SRC} @@ -117,7 +118,7 @@ WORKDIR ${INVOKEAI_SRC} RUN cd /usr/lib/$(uname -p)-linux-gnu/pkgconfig/ && ln -sf opencv4.pc opencv.pc RUN python3 -c "from patchmatch import patch_match" -RUN mkdir -p ${INVOKEAI_ROOT} && chown -R 1000:1000 ${INVOKEAI_ROOT} +RUN mkdir -p ${INVOKEAI_ROOT} && chown -R ${CONTAINER_UID}:${CONTAINER_UID} ${INVOKEAI_ROOT} COPY docker/docker-entrypoint.sh ./ ENTRYPOINT ["/opt/invokeai/docker-entrypoint.sh"]