-
Notifications
You must be signed in to change notification settings - Fork 38
ITEP-81653: Reduce cluster analytics runtime image size #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8f1f856
07a6a05
e379b8c
4646765
7a08a76
5cc2144
ec035c0
b15bbee
9508156
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,8 +40,10 @@ | |||||||||||||||||||||||||||||||||||||||||||
| && rm -rf scene_common \ | ||||||||||||||||||||||||||||||||||||||||||||
| && rm -f /tmp/requirements-build.txt | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| COPY ./tools/waitforbroker /tmp/tools/waitforbroker | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # -------------- Cluster Analytics Runtime Stage -------------- | ||||||||||||||||||||||||||||||||||||||||||||
| FROM scenescape-common-base-24-04 AS scenescape-cluster-analytics-runtime | ||||||||||||||||||||||||||||||||||||||||||||
| FROM python:3.12-slim AS scenescape-cluster-analytics-runtime | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Label image with description and metadata | ||||||||||||||||||||||||||||||||||||||||||||
| LABEL org.opencontainers.image.description="Intel® SceneScape's Scene Cluster Analytics Service" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -53,51 +55,53 @@ | |||||||||||||||||||||||||||||||||||||||||||
| ARG USER_ID=1001 | ||||||||||||||||||||||||||||||||||||||||||||
| ARG GROUP_ID=1001 | ||||||||||||||||||||||||||||||||||||||||||||
| ARG CERTDOMAIN=scenescape.intel.com | ||||||||||||||||||||||||||||||||||||||||||||
| ARG PYTHON_VERSION=3.12 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ENV PYTHON_VERSION=${PYTHON_VERSION} | ||||||||||||||||||||||||||||||||||||||||||||
| ENV WSUSER=scenescape | ||||||||||||||||||||||||||||||||||||||||||||
| ENV SCENESCAPE_HOME=/home/$WSUSER/SceneScape | ||||||||||||||||||||||||||||||||||||||||||||
| ENV BUILD_ENV_DIR=/tmp/venv | ||||||||||||||||||||||||||||||||||||||||||||
| ENV BUILD_ENV_DIR=/opt/venv | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ENV DEBIAN_FRONTEND=noninteractive | ||||||||||||||||||||||||||||||||||||||||||||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| RUN : \ | ||||||||||||||||||||||||||||||||||||||||||||
| && apt-get update \ | ||||||||||||||||||||||||||||||||||||||||||||
| && apt-get install -y --no-install-recommends \ | ||||||||||||||||||||||||||||||||||||||||||||
| # Install only minimal runtime system dependencies | ||||||||||||||||||||||||||||||||||||||||||||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||||||||||||||||||||||||||||||||||||||||||||
| libgl1 \ | ||||||||||||||||||||||||||||||||||||||||||||
| libopencv-contrib406t64 \ | ||||||||||||||||||||||||||||||||||||||||||||
| libpython3.12 \ | ||||||||||||||||||||||||||||||||||||||||||||
| netbase \ | ||||||||||||||||||||||||||||||||||||||||||||
| && rm -rf /usr/lib/x86_64-linux-gnu/libLLVM-15.so.1 \ | ||||||||||||||||||||||||||||||||||||||||||||
| && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||||||||||||||||||||||||||||||||||||||||||||
| libglib2.0-0 \ | ||||||||||||||||||||||||||||||||||||||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| RUN : \ | ||||||||||||||||||||||||||||||||||||||||||||
| # delete ubuntu user if exists | ||||||||||||||||||||||||||||||||||||||||||||
| && userdel -f -r ubuntu || true \ | ||||||||||||||||||||||||||||||||||||||||||||
| # create scenescape user | ||||||||||||||||||||||||||||||||||||||||||||
| && groupadd -g ${GROUP_ID} $WSUSER \ | ||||||||||||||||||||||||||||||||||||||||||||
| # Create a venv (already optimized in slim images) | ||||||||||||||||||||||||||||||||||||||||||||
| RUN python3 -m venv $BUILD_ENV_DIR | ||||||||||||||||||||||||||||||||||||||||||||
| ENV PATH="$BUILD_ENV_DIR/bin:$PATH" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Install core Python dependencies | ||||||||||||||||||||||||||||||||||||||||||||
| RUN pip install --no-cache-dir --upgrade pip numpy opencv-python-headless==4.6.0.66 | ||||||||||||||||||||||||||||||||||||||||||||
Check warningCode scanning / Scorecard Pinned-Dependencies Medium
score is 3: pipCommand not pinned by hash
Click Remediation section below to solve this issue |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Copy compiled scene_common + fast_geometry from builder | ||||||||||||||||||||||||||||||||||||||||||||
| COPY --chown=$WSUSER:$WSUSER --from=scenescape-common-base-24-04 /usr/local/lib/python3.12/dist-packages/scene_common \ | ||||||||||||||||||||||||||||||||||||||||||||
| $BUILD_ENV_DIR/lib/python3.12/site-packages/scene_common | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| COPY --chown=$WSUSER:$WSUSER --from=scenescape-common-base-24-04 /usr/local/lib/python3.12/dist-packages/fast_geometry \ | ||||||||||||||||||||||||||||||||||||||||||||
| $BUILD_ENV_DIR/lib/python3.12/site-packages/fast_geometry | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+75
to
+83
|
||||||||||||||||||||||||||||||||||||||||||||
| # Install core Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip numpy opencv-python-headless==4.6.0.66 | |
| # Copy compiled scene_common + fast_geometry from builder | |
| COPY --chown=$WSUSER:$WSUSER --from=scenescape-common-base-24-04 /usr/local/lib/python3.12/dist-packages/scene_common \ | |
| $BUILD_ENV_DIR/lib/python3.12/site-packages/scene_common | |
| COPY --chown=$WSUSER:$WSUSER --from=scenescape-common-base-24-04 /usr/local/lib/python3.12/dist-packages/fast_geometry \ | |
| $BUILD_ENV_DIR/lib/python3.12/site-packages/fast_geometry | |
| # Dynamically determine Python version (major.minor) | |
| ENV PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") | |
| # Install core Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip numpy opencv-python-headless==4.6.0.66 | |
| # Copy compiled scene_common + fast_geometry from builder | |
| COPY --chown=$WSUSER:$WSUSER --from=scenescape-common-base-24-04 /usr/local/lib/${PYTHON_VERSION}/dist-packages/scene_common \ | |
| $BUILD_ENV_DIR/lib/${PYTHON_VERSION}/site-packages/scene_common | |
| COPY --chown=$WSUSER:$WSUSER --from=scenescape-common-base-24-04 /usr/local/lib/${PYTHON_VERSION}/dist-packages/fast_geometry \ | |
| $BUILD_ENV_DIR/lib/${PYTHON_VERSION}/site-packages/fast_geometry |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Python version 3.12 is hardcoded in the path. Since the base image is python:3.12-slim, consider using a variable or dynamic path to make future Python version updates easier.
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
Click Remediation section below to solve this issue
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
Click Remediation section below to solve this issue
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The healthcheck always returns success (true), making it ineffective. Replace with an actual health check that verifies the service is functioning correctly, such as checking if the application responds to requests or a specific health endpoint.
| HEALTHCHECK CMD true | |
| HEALTHCHECK CMD curl --fail --silent http://localhost:8000/health || exit 1 |
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium