diff --git a/packages/postgres-database/docker/Dockerfile b/packages/postgres-database/docker/Dockerfile index 687ee0e2f27..63f84d10762 100644 --- a/packages/postgres-database/docker/Dockerfile +++ b/packages/postgres-database/docker/Dockerfile @@ -32,6 +32,10 @@ COPY --from=uv_build /uv /uvx /bin/ # NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv RUN uv venv "${VIRTUAL_ENV}" +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy + ARG GIT_BRANCH ARG GIT_REPOSITORY @@ -41,8 +45,6 @@ RUN git clone --single-branch --branch ${GIT_BRANCH} ${GIT_REPOSITORY} osparc-si FROM base AS production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu # ensure home folder is read/writable for user scu diff --git a/packages/service-integration/Dockerfile b/packages/service-integration/Dockerfile index ed59d613346..39e6841602c 100644 --- a/packages/service-integration/Dockerfile +++ b/packages/service-integration/Dockerfile @@ -50,7 +50,8 @@ ENV LANG=C.UTF-8 ENV PYTHONDONTWRITEBYTECODE=1 \ VIRTUAL_ENV=/home/scu/.venv # https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy # Ensures that the python and pip executables used # in the image will be those from our virtualenv. diff --git a/services/agent/Dockerfile b/services/agent/Dockerfile index b933f61ee07..f2073066cc1 100644 --- a/services/agent/Dockerfile +++ b/services/agent/Dockerfile @@ -33,6 +33,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ curl \ && apt-get clean -y \ @@ -113,6 +114,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/agent @@ -138,8 +142,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/agent/docker/boot.sh b/services/agent/docker/boot.sh index 5cc8f9f5aad..b972c9dfd78 100755 --- a/services/agent/docker/boot.sh +++ b/services/agent/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/agent - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -48,15 +48,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) - + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/agent/src/simcore_service_agent && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${AGENT_SERVER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --port 8000 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/agent/docker/entrypoint.sh b/services/agent/docker/entrypoint.sh index e89ad5408a3..c1697b74b85 100755 --- a/services/agent/docker/entrypoint.sh +++ b/services/agent/docker/entrypoint.sh @@ -56,10 +56,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/api-server/Dockerfile b/services/api-server/Dockerfile index a28d8ccf5b4..9f9b0da600a 100644 --- a/services/api-server/Dockerfile +++ b/services/api-server/Dockerfile @@ -30,6 +30,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -106,6 +107,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/api-server @@ -132,8 +136,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/api-server/docker/boot.sh b/services/api-server/docker/boot.sh index ea12e3446c9..1e41a3f8e13 100755 --- a/services/api-server/docker/boot.sh +++ b/services/api-server/docker/boot.sh @@ -19,7 +19,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/api-server - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -28,7 +28,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -40,14 +40,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/api-server/src/simcore_service_api_server && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${API_SERVER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/api-server/docker/entrypoint.sh b/services/api-server/docker/entrypoint.sh index b579236b562..e5060ff8f7b 100755 --- a/services/api-server/docker/entrypoint.sh +++ b/services/api-server/docker/entrypoint.sh @@ -57,10 +57,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/autoscaling/Dockerfile b/services/autoscaling/Dockerfile index b4449bf6e3a..cd1a088ec08 100644 --- a/services/autoscaling/Dockerfile +++ b/services/autoscaling/Dockerfile @@ -34,6 +34,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ ca-certificates \ curl \ @@ -122,6 +123,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/autoscaling @@ -147,8 +151,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu # ensure home folder is read/writable for user scu diff --git a/services/autoscaling/docker/boot.sh b/services/autoscaling/docker/boot.sh index c78cf322c2d..79f86d977af 100755 --- a/services/autoscaling/docker/boot.sh +++ b/services/autoscaling/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/autoscaling - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - uv pip list fi @@ -32,7 +32,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -47,14 +47,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/autoscaling/src/simcore_service_autoscaling && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${AUTOSCALING_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/autoscaling/docker/entrypoint.sh b/services/autoscaling/docker/entrypoint.sh index ad982fd8d5c..1071a664b92 100755 --- a/services/autoscaling/docker/entrypoint.sh +++ b/services/autoscaling/docker/entrypoint.sh @@ -63,10 +63,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/catalog/Dockerfile b/services/catalog/Dockerfile index f799fb9f4f8..2fd10e65309 100644 --- a/services/catalog/Dockerfile +++ b/services/catalog/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -108,6 +109,10 @@ FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy + WORKDIR /build/services/catalog RUN \ @@ -132,8 +137,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/catalog/docker/boot.sh b/services/catalog/docker/boot.sh index 9db9967c98f..3efc6789681 100755 --- a/services/catalog/docker/boot.sh +++ b/services/catalog/docker/boot.sh @@ -19,7 +19,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/catalog - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -28,7 +28,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -40,14 +40,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/catalog/src/simcore_service_catalog && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${CATALOG_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/catalog/docker/entrypoint.sh b/services/catalog/docker/entrypoint.sh index 63e9249be31..9e820488a53 100755 --- a/services/catalog/docker/entrypoint.sh +++ b/services/catalog/docker/entrypoint.sh @@ -56,10 +56,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/clusters-keeper/Dockerfile b/services/clusters-keeper/Dockerfile index caae1db9bbc..a775c6d441f 100644 --- a/services/clusters-keeper/Dockerfile +++ b/services/clusters-keeper/Dockerfile @@ -34,6 +34,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ ca-certificates \ curl \ @@ -125,6 +126,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/clusters-keeper @@ -150,8 +154,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu # ensure home folder is read/writable for user scu diff --git a/services/clusters-keeper/docker/boot.sh b/services/clusters-keeper/docker/boot.sh index 384133c7a87..562dcc89f14 100755 --- a/services/clusters-keeper/docker/boot.sh +++ b/services/clusters-keeper/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/clusters-keeper - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -48,14 +48,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/clusters-keeper/src/simcore_service_clusters_keeper && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${CLUSTERS_KEEPER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/clusters-keeper/docker/entrypoint.sh b/services/clusters-keeper/docker/entrypoint.sh index 66fbfba9200..1071a664b92 100755 --- a/services/clusters-keeper/docker/entrypoint.sh +++ b/services/clusters-keeper/docker/entrypoint.sh @@ -63,14 +63,12 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi - # Appends docker group if socket is mounted DOCKER_MOUNT=/var/run/docker.sock if stat $DOCKER_MOUNT >/dev/null 2>&1; then diff --git a/services/dask-sidecar/Dockerfile b/services/dask-sidecar/Dockerfile index 30065378151..ef5e199bdd5 100644 --- a/services/dask-sidecar/Dockerfile +++ b/services/dask-sidecar/Dockerfile @@ -26,6 +26,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux \ && apt-get update \ && apt-get install -y --no-install-recommends \ + fd-find \ iputils-ping \ curl \ gosu \ @@ -107,6 +108,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/dask-sidecar @@ -131,8 +135,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu # ensure home folder is read/writable for user scu diff --git a/services/dask-sidecar/docker/boot.sh b/services/dask-sidecar/docker/boot.sh index 30cb7397189..f26cdd9f8a3 100755 --- a/services/dask-sidecar/docker/boot.sh +++ b/services/dask-sidecar/docker/boot.sh @@ -25,7 +25,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then python --version | sed 's/^/ /' command -v python | sed 's/^/ /' cd services/dask-sidecar - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - print_info "PIP :" uv pip list @@ -34,7 +34,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi diff --git a/services/dask-sidecar/docker/entrypoint.sh b/services/dask-sidecar/docker/entrypoint.sh index f69fd1a71d8..b65860a3ef6 100755 --- a/services/dask-sidecar/docker/entrypoint.sh +++ b/services/dask-sidecar/docker/entrypoint.sh @@ -58,10 +58,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/datcore-adapter/Dockerfile b/services/datcore-adapter/Dockerfile index e3b76c29565..5b655edbf59 100644 --- a/services/datcore-adapter/Dockerfile +++ b/services/datcore-adapter/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -108,6 +109,10 @@ FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy + WORKDIR /build/services/datcore-adapter RUN \ @@ -132,8 +137,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/datcore-adapter/docker/boot.sh b/services/datcore-adapter/docker/boot.sh index 187ea506ba8..ca19372d572 100755 --- a/services/datcore-adapter/docker/boot.sh +++ b/services/datcore-adapter/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/datcore-adapter - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -45,14 +45,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/datcore-adapter/src/simcore_service_datcore_adapter && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DATCORE_ADAPTER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/datcore-adapter/docker/entrypoint.sh b/services/datcore-adapter/docker/entrypoint.sh index 25153a6b2a2..b55d4bc7716 100755 --- a/services/datcore-adapter/docker/entrypoint.sh +++ b/services/datcore-adapter/docker/entrypoint.sh @@ -56,10 +56,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/director-v2/Dockerfile b/services/director-v2/Dockerfile index 80cb5fd4d66..ab57f8d5472 100644 --- a/services/director-v2/Dockerfile +++ b/services/director-v2/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -107,6 +108,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/director-v2 @@ -132,8 +136,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/director-v2/docker/boot.sh b/services/director-v2/docker/boot.sh index 1af7ab240de..9dc04a97fcf 100755 --- a/services/director-v2/docker/boot.sh +++ b/services/director-v2/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/director-v2 - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -47,14 +47,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/director-v2/src/simcore_service_director_v2 && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DIRECTOR_V2_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/director-v2/docker/entrypoint.sh b/services/director-v2/docker/entrypoint.sh index 42995c6ae78..244f9b6a1db 100755 --- a/services/director-v2/docker/entrypoint.sh +++ b/services/director-v2/docker/entrypoint.sh @@ -63,10 +63,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/director/Dockerfile b/services/director/Dockerfile index cdcdc88d839..8ff33334260 100644 --- a/services/director/Dockerfile +++ b/services/director/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -103,6 +104,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/director @@ -128,8 +132,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu # ensure home folder is read/writable for user scu diff --git a/services/director/docker/boot.sh b/services/director/docker/boot.sh index af732895050..67298472d0e 100755 --- a/services/director/docker/boot.sh +++ b/services/director/docker/boot.sh @@ -24,15 +24,15 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/director - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - - uv pip list + # uv pip list fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -47,14 +47,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/director/src/simcore_service_director && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DIRECTOR_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/director/docker/entrypoint.sh b/services/director/docker/entrypoint.sh index ad982fd8d5c..1071a664b92 100755 --- a/services/director/docker/entrypoint.sh +++ b/services/director/docker/entrypoint.sh @@ -63,10 +63,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/dynamic-scheduler/Dockerfile b/services/dynamic-scheduler/Dockerfile index 6ea7d585374..380ac0eaba6 100644 --- a/services/dynamic-scheduler/Dockerfile +++ b/services/dynamic-scheduler/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -104,6 +105,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/dynamic-scheduler @@ -129,8 +133,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/dynamic-scheduler/docker/boot.sh b/services/dynamic-scheduler/docker/boot.sh index dae7ea09e1b..89e85223aa6 100755 --- a/services/dynamic-scheduler/docker/boot.sh +++ b/services/dynamic-scheduler/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/dynamic-scheduler - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -48,14 +48,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/dynamic-scheduler/src/simcore_service_dynamic_scheduler && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DYNAMIC_SCHEDULER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/dynamic-scheduler/docker/entrypoint.sh b/services/dynamic-scheduler/docker/entrypoint.sh index 25153a6b2a2..b55d4bc7716 100755 --- a/services/dynamic-scheduler/docker/entrypoint.sh +++ b/services/dynamic-scheduler/docker/entrypoint.sh @@ -56,10 +56,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/dynamic-sidecar/Dockerfile b/services/dynamic-sidecar/Dockerfile index 90009b0dffa..87f5e07fe08 100644 --- a/services/dynamic-sidecar/Dockerfile +++ b/services/dynamic-sidecar/Dockerfile @@ -48,6 +48,7 @@ RUN \ && apt-get install -y --no-install-recommends \ docker-ce-cli=${DOCKER_APT_VERSION} \ docker-compose-plugin=${DOCKER_COMPOSE_APT_VERSION} \ + fd-find \ gosu \ ca-certificates \ # required by python-magic @@ -159,6 +160,9 @@ COPY --chown=root:root services/dynamic-sidecar/scripts/Makefile /root FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/dynamic-sidecar @@ -183,8 +187,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/dynamic-sidecar/docker/boot.sh b/services/dynamic-sidecar/docker/boot.sh index 152fc8a04c0..cb209e00cc9 100755 --- a/services/dynamic-sidecar/docker/boot.sh +++ b/services/dynamic-sidecar/docker/boot.sh @@ -25,7 +25,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then # NOTE: uv does not like this requirement file... cd /devel/services/dynamic-sidecar - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" pip list | sed 's/^/ /' @@ -34,7 +34,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -49,14 +49,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/dynamic-sidecar/src/simcore_service_dynamic_sidecar && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DYNAMIC_SIDECAR_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/dynamic-sidecar/docker/entrypoint.sh b/services/dynamic-sidecar/docker/entrypoint.sh index 73815d447dd..74eb8867b74 100755 --- a/services/dynamic-sidecar/docker/entrypoint.sh +++ b/services/dynamic-sidecar/docker/entrypoint.sh @@ -67,10 +67,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/efs-guardian/Dockerfile b/services/efs-guardian/Dockerfile index 1c5f3303f70..3b73b094698 100644 --- a/services/efs-guardian/Dockerfile +++ b/services/efs-guardian/Dockerfile @@ -34,6 +34,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ ca-certificates \ curl \ @@ -143,6 +144,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/efs-guardian @@ -168,8 +172,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/efs diff --git a/services/efs-guardian/docker/boot.sh b/services/efs-guardian/docker/boot.sh index 862a3456b26..317ee312459 100755 --- a/services/efs-guardian/docker/boot.sh +++ b/services/efs-guardian/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/efs-guardian - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -48,14 +48,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/efs-guardian/src/simcore_service_efs_guardian && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${EFS_GUARDIAN_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/efs-guardian/docker/entrypoint.sh b/services/efs-guardian/docker/entrypoint.sh index d8ddf1c826a..a1b9ea0137d 100755 --- a/services/efs-guardian/docker/entrypoint.sh +++ b/services/efs-guardian/docker/entrypoint.sh @@ -63,14 +63,12 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$EFS_USER_NAME" echo "$INFO" "Changing group properties of files around from $EFS_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$EFS_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$EFS_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $EFS_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$EFS_USER_ID" -exec chown --no-dereference "$EFS_USER_NAME" {} \; + fdfind --owner "$EFS_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$EFS_USER_NAME" . '/' fi fi - # Appends docker group if socket is mounted DOCKER_MOUNT=/var/run/docker.sock if stat $DOCKER_MOUNT >/dev/null 2>&1; then diff --git a/services/invitations/Dockerfile b/services/invitations/Dockerfile index 890d3d3e3be..33a9251daaf 100644 --- a/services/invitations/Dockerfile +++ b/services/invitations/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -107,6 +108,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/invitations @@ -132,8 +136,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/invitations/docker/boot.sh b/services/invitations/docker/boot.sh index 0616dc4c2b7..99afa6e1a75 100755 --- a/services/invitations/docker/boot.sh +++ b/services/invitations/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/invitations - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -48,14 +48,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/invitations/src/simcore_service_invitations && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${INVITATIONS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/invitations/docker/entrypoint.sh b/services/invitations/docker/entrypoint.sh index 25153a6b2a2..b55d4bc7716 100755 --- a/services/invitations/docker/entrypoint.sh +++ b/services/invitations/docker/entrypoint.sh @@ -56,10 +56,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/migration/Dockerfile b/services/migration/Dockerfile index 380ead9651b..ca2cf6bbd50 100644 --- a/services/migration/Dockerfile +++ b/services/migration/Dockerfile @@ -60,6 +60,10 @@ COPY --from=uv_build /uv /uvx /bin/ # NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv RUN uv venv "${VIRTUAL_ENV}" +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy + @@ -79,8 +83,6 @@ RUN \ FROM base AS production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 # testing defaults ENV POSTGRES_USER=scu \ diff --git a/services/notifications/Dockerfile b/services/notifications/Dockerfile index 173dd3ba995..f01d12c4f41 100644 --- a/services/notifications/Dockerfile +++ b/services/notifications/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ # verify that the binary works @@ -104,6 +105,10 @@ FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy + WORKDIR /build/services/notifications RUN \ @@ -128,8 +133,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/notifications/docker/boot.sh b/services/notifications/docker/boot.sh index 8d079d9bc1b..8aae19c2f8e 100755 --- a/services/notifications/docker/boot.sh +++ b/services/notifications/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/notifications - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -48,7 +48,7 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/notifications/src/simcore_service_notifications && \ @@ -56,7 +56,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then --host 0.0.0.0 \ --port 8000 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/notifications/docker/entrypoint.sh b/services/notifications/docker/entrypoint.sh index 1568d6affdc..b55d4bc7716 100755 --- a/services/notifications/docker/entrypoint.sh +++ b/services/notifications/docker/entrypoint.sh @@ -56,14 +56,12 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi - echo "$INFO Starting $* ..." echo " $SC_USER_NAME rights : $(id "$SC_USER_NAME")" echo " local dir : $(ls -al)" diff --git a/services/payments/Dockerfile b/services/payments/Dockerfile index df0eb6e1205..23d1793eb33 100644 --- a/services/payments/Dockerfile +++ b/services/payments/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -107,6 +108,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/payments @@ -132,8 +136,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/payments/docker/boot.sh b/services/payments/docker/boot.sh index 1cc69d83665..740e8ff1e17 100755 --- a/services/payments/docker/boot.sh +++ b/services/payments/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/payments - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -48,14 +48,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/payments/src/simcore_service_payments && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${PAYMENTS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/payments/docker/entrypoint.sh b/services/payments/docker/entrypoint.sh index 25153a6b2a2..b55d4bc7716 100755 --- a/services/payments/docker/entrypoint.sh +++ b/services/payments/docker/entrypoint.sh @@ -56,10 +56,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/resource-usage-tracker/Dockerfile b/services/resource-usage-tracker/Dockerfile index c8cc16026ec..b19ed19a464 100644 --- a/services/resource-usage-tracker/Dockerfile +++ b/services/resource-usage-tracker/Dockerfile @@ -31,6 +31,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -107,6 +108,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy WORKDIR /build/services/resource-usage-tracker @@ -132,8 +136,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/resource-usage-tracker/docker/boot.sh b/services/resource-usage-tracker/docker/boot.sh index fe90bb17050..b1863b10308 100755 --- a/services/resource-usage-tracker/docker/boot.sh +++ b/services/resource-usage-tracker/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/resource-usage-tracker - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -48,14 +48,14 @@ SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]') echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL" if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/resource-usage-tracker/src/simcore_service_resource_usage_tracker && \ python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${RESOURCE_USAGE_TRACKER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/resource-usage-tracker/docker/entrypoint.sh b/services/resource-usage-tracker/docker/entrypoint.sh index e89ad5408a3..c1697b74b85 100755 --- a/services/resource-usage-tracker/docker/entrypoint.sh +++ b/services/resource-usage-tracker/docker/entrypoint.sh @@ -56,10 +56,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/storage/Dockerfile b/services/storage/Dockerfile index 04519f8892e..d7f0fdf554f 100644 --- a/services/storage/Dockerfile +++ b/services/storage/Dockerfile @@ -30,6 +30,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ gosu \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* \ @@ -118,6 +119,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy # 2nd party packages WORKDIR /build/services/storage @@ -144,8 +148,6 @@ ENV SC_BUILD_TARGET=production \ SC_HEALTHCHECK_RETRY=3 ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/storage/docker/boot.sh b/services/storage/docker/boot.sh index 1b39def4a2e..3e1fff945d1 100755 --- a/services/storage/docker/boot.sh +++ b/services/storage/docker/boot.sh @@ -24,7 +24,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/storage - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -33,7 +33,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi @@ -72,7 +72,7 @@ if [ "${STORAGE_WORKER_MODE}" = "true" ]; then fi else if [ "${SC_BOOT_MODE}" = "debug" ]; then - reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;) + reload_dir_packages=$(fdfind src /devel/packages --exec echo '--reload-dir {} ' | tr '\n' ' ') exec sh -c " cd services/storage/src/simcore_service_storage && \ @@ -80,7 +80,7 @@ else --host 0.0.0.0 \ --port ${STORAGE_PORT} \ --reload \ - $reload_dir_packages + $reload_dir_packages \ --reload-dir . \ --log-level \"${SERVER_LOG_LEVEL}\" " diff --git a/services/storage/docker/entrypoint.sh b/services/storage/docker/entrypoint.sh index 11684a3a591..8511f90e1d7 100755 --- a/services/storage/docker/entrypoint.sh +++ b/services/storage/docker/entrypoint.sh @@ -61,10 +61,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi diff --git a/services/web/Dockerfile b/services/web/Dockerfile index 292855b825d..2c0d83ed0a0 100644 --- a/services/web/Dockerfile +++ b/services/web/Dockerfile @@ -32,6 +32,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ set -eux && \ apt-get update && \ apt-get install -y --no-install-recommends \ + fd-find \ curl \ gosu \ libmagic1 \ @@ -126,6 +127,9 @@ WORKDIR /build FROM build AS prod-only-deps ENV SC_BUILD_TARGET=prod-only-deps +# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode +ENV UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy # 2nd party packages WORKDIR /build/services/web/server @@ -151,8 +155,6 @@ ENV SC_BUILD_TARGET=production \ SC_BOOT_MODE=production ENV PYTHONOPTIMIZE=TRUE -# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode -ENV UV_COMPILE_BYTECODE=1 WORKDIR /home/scu diff --git a/services/web/server/docker/boot.sh b/services/web/server/docker/boot.sh index add4415d44d..1fa26ebbda9 100755 --- a/services/web/server/docker/boot.sh +++ b/services/web/server/docker/boot.sh @@ -19,7 +19,7 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then command -v python | sed 's/^/ /' cd services/web/server - uv pip --quiet sync requirements/dev.txt + uv pip --quiet sync --link-mode=copy requirements/dev.txt cd - echo "$INFO" "PIP :" uv pip list @@ -32,7 +32,7 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy if command -v uv >/dev/null 2>&1; then - uv pip install debugpy + uv pip install --link-mode=copy debugpy else pip install debugpy fi diff --git a/services/web/server/docker/entrypoint.sh b/services/web/server/docker/entrypoint.sh index d7e4f13bb7a..9e7e1a2bc2e 100755 --- a/services/web/server/docker/entrypoint.sh +++ b/services/web/server/docker/entrypoint.sh @@ -28,9 +28,6 @@ echo "$INFO" "User : $(id scu)" echo "$INFO" "python : $(command -v python)" echo "$INFO" "pip : $(command -v pip)" -USERNAME=scu -GROUPNAME=scu - if [ "${SC_BUILD_TARGET}" = "development" ]; then echo "$INFO" "development mode detected..." # NOTE: expects docker run ... -v $(pwd):$DEVEL_MOUNT @@ -64,10 +61,9 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then usermod --uid "$HOST_USERID" --gid "$HOST_GROUPID" "$SC_USER_NAME" echo "$INFO" "Changing group properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -group "$SC_USER_ID" -exec chgrp --no-dereference "$CONT_GROUPNAME" {} \; - # change user property of files already around + fdfind --owner ":$SC_USER_ID" --exclude proc --exec-batch chgrp --no-dereference "$CONT_GROUPNAME" . '/' echo "$INFO" "Changing ownership properties of files around from $SC_USER_ID to group $CONT_GROUPNAME" - find / -path /proc -prune -o -user "$SC_USER_ID" -exec chown --no-dereference "$SC_USER_NAME" {} \; + fdfind --owner "$SC_USER_ID:" --exclude proc --exec-batch chown --no-dereference "$SC_USER_NAME" . '/' fi fi