mint icon indicating copy to clipboard operation
mint copied to clipboard

Image Slim Failed

Open HJX-zhanS opened this issue 3 months ago • 1 comments

Hello, I am attempting to slim an image using the command ./mint build --http-probe=false [IMAGE_ID]. This image was built from a Dockerfile ​with an entry point set to​ CMD ["npm", "test"]. However, when running the slimmed container, ​I encounter​ a "Node.js not found" error.

Here is the Dockerfile.

FROM node:current
RUN npm config set registry https://registry.npmmirror.com \
    && mkdir -p /opt/target-project \
    && mkdir -p /opt/npm_pkgs/node_cache \
    && mkdir -p /opt/npm_pkgs/node_global \
    && mkdir -p /opt/npm_pkgs/node_modules
COPY ./target-project /opt/target-project
WORKDIR /opt/target-project
RUN npm config set prefix "/opt/npm_pkgs/node_global" \
    && npm config set cache "/opt/npm_pkgs/node_cache" \
    && echo 'export PATH=/opt/npm_pkgs/node_global/bin:$PATH' >> ~/.profile \
    && echo 'export PATH=/opt/npm_pkgs/node_cache/bin:$PATH' >> ~/.profile \
    && /bin/bash -c "source ~/.profile" \
    && chmod -R 777 /opt \
    && npm install
CMD ["npm", "test"]

HJX-zhanS avatar Aug 16 '25 06:08 HJX-zhanS