Skip to content

Image Slim Failed #137

Description

@HJX-zhanS

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions