Skip to content

[FEATURE] Support custom base images #23

@duaraghav8

Description

@duaraghav8

Is your feature request related to a problem you're facing?
Currently, Dockershrink only supports and works well with the official nodejs base images.
So it works good if your dockerfile says FROM node:22 for eg, but doesn't provide much benefit if you're using a custom base image, which is what a lot of enterprises do.

Describe the solution you'd like
DS should be able to provide optimizations even if the user isn't using the official nodejs image as their base image.

Scope
If a nodejs app's Dockerfile is using a custom base image:

  1. DS should assume that this base image already contains NodeJS.
    It is possible that it doesn't and the user is installing nodejs separately in the dockerfile, but that is out of scope of this issue.
  2. The rule final-stage-slim-baseimage should only check for and enforce lightweight base image if the current base image being used in dockerfile is a community-provided one (eg- node:22, distroless/nodejs, chainguard nodejs, etc).
    In case of a custom docker image, this rule should not run. Scanning custom base image is out of scope for this issue.
  3. In case DS adds another stage to the Dockerfile, the new stage must use the same custom base image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions