You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
Introduce an INCLUDE directive in Dockerfile syntax to allow inclusion of external file fragments. This would help reduce code duplication and improve maintainability.
Motivation
Dockerfiles often contain repetitive commands or similar configurations. By enabling an INCLUDE directive, developers could.
Proposed Implementation
Syntax:
INCLUDE path
Behavior:
The contents of the specified file should be read and inserted at the point of the INCLUDE directive. All build-time variables (e.g., ARGs, ENV variables) in scope should be accessible within the included content.
Example Usage
Given the following Dockerfile:
FROM alpine
ARG filename
ARG myvar
RUN echo "Before including ${filename}, it will inherit ARGs from this file"
INCLUDE ${filename}
RUN echo "After including ${filename}"
And a file named template.txt containing:
RUN echo "here we can access myvar: ${myvar} and filename: ${filename}"
Description
Summary
Introduce an
INCLUDE
directive in Dockerfile syntax to allow inclusion of external file fragments. This would help reduce code duplication and improve maintainability.Motivation
Dockerfiles often contain repetitive commands or similar configurations. By enabling an
INCLUDE
directive, developers could.Proposed Implementation
The contents of the specified file should be read and inserted at the point of the
INCLUDE
directive. All build-time variables (e.g., ARGs, ENV variables) in scope should be accessible within the included content.Example Usage
Given the following Dockerfile:
And a file named
template.txt
containing:Building with:
The existing alternatives like https://codeberg.org/devthefuture/dockerfile-x do not work with arg, they omit everything before the INCLUDE line.
The text was updated successfully, but these errors were encountered: