Skip to content
6 changes: 4 additions & 2 deletions packages/postgres-database/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion packages/service-integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions services/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
9 changes: 4 additions & 5 deletions services/agent/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}\"
"
Expand Down
5 changes: 2 additions & 3 deletions services/agent/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions services/api-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/* \
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions services/api-server/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}\"
"
Expand Down
5 changes: 2 additions & 3 deletions services/api-server/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions services/autoscaling/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions services/autoscaling/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ 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

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
Expand All @@ -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}\"
"
Expand Down
5 changes: 2 additions & 3 deletions services/autoscaling/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions services/catalog/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/* \
Expand Down Expand Up @@ -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 \
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions services/catalog/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}\"
"
Expand Down
5 changes: 2 additions & 3 deletions services/catalog/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions services/clusters-keeper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions services/clusters-keeper/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}\"
"
Expand Down
Loading
Loading