update Dockerfile

- introduce build arg `VOLUME_DIR`
- fix permissions of the Volume
This commit is contained in:
mauwii 2023-02-10 22:55:19 +01:00
parent d9cb6da951
commit 7be5b4ca8b
No known key found for this signature in database
GPG Key ID: D923DB04ADB3F5AB

View File

@ -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}" ]