Skip to content

Optimize layers in runtime-deps images #4419

@lbussell

Description

@lbussell

In runtime-deps images, we set the environment variables after we install dependencies and other instructions. Since the environment variables basically never change, we should be able to put the ENV instruction before the dependency installation to take advantage of layer caching.

Also, in some runtime-deps Dockerfiles with a non-root user defined, it is defined after the deps install. We should be able to make the same optimization with these instructions too.

Example Dockerfile with potential for both optimizations: https://github.com/dotnet/dotnet-docker/blob/nightly/src/runtime-deps/7.0/cbl-mariner2.0-distroless/amd64/Dockerfile

Metadata

Metadata

Assignees

Labels

area-dockerfilesConcerns the official .NET Dockerfiles or Dockerfile templates

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions