From 7be5b4ca8b27c4453bde3f9cf9888159c6995b26 Mon Sep 17 00:00:00 2001 From: mauwii Date: Fri, 10 Feb 2023 22:55:19 +0100 Subject: [PATCH] update Dockerfile - introduce build arg `VOLUME_DIR` - fix permissions of the Volume --- docker/Dockerfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ba3d49a950..a3619d15ab 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -85,14 +85,19 @@ RUN useradd \ -m \ -U \ "${UNAME}" -USER ${UNAME} + +# create volume directory +ARG VOLUME_DIR=/data +RUN mkdir -p "${VOLUME_DIR}" \ + && chown -R "${UNAME}" "${VOLUME_DIR}" # setup runtime environment +USER ${UNAME} COPY --chown=${UNAME} --from=pyproject-builder ${APPDIR}/${APPNAME} ${APPNAME} -ENV INVOKEAI_ROOT /data -ENV TRANSFORMERS_CACHE /data/.cache +ENV INVOKEAI_ROOT ${VOLUME_DIR} +ENV TRANSFORMERS_CACHE ${VOLUME_DIR}/.cache ENV INVOKE_MODEL_RECONFIGURE "--yes --default_only" EXPOSE 9090 ENTRYPOINT [ "invokeai" ] CMD [ "--web", "--host", "0.0.0.0", "--port", "9090" ] -VOLUME [ "/data" ] +VOLUME [ "${VOLUME_DIR}" ]