Skip to content

Docker image flattening loses USER and ENV directives in clp-package Dockerfile #1379

@coderabbitai

Description

@coderabbitai

Problem

In tools/docker-images/clp-package/Dockerfile, the USER and ENV commands are declared in the base stage (lines 13-18) before the image is flattened using FROM scratch and COPY --from=base. This causes their effects to be lost in the final image.

Details

The following directives are currently in the base stage:

  • ENV CLP_HOME="/opt/clp"
  • ENV PATH="${CLP_HOME}/bin:${PATH}"
  • ENV PATH="${CLP_HOME}/sbin:${PATH}"
  • ENV PYTHONPATH="${CLP_HOME}/lib/python3/site-packages"
  • USER 1000:1000

When the image is flattened with FROM scratch followed by COPY --from=base / /, these directives are not preserved in the final image metadata.

Solution

These directives should be moved to after the COPY --from=base / / command in the final stage to ensure they are present in the resulting image.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions