Skip to content

Commit ad33d73

Browse files
committed
chore: add INCLUDE_ARGS, INCLUDE_ENVS, INCLUDE_LABELS to README.md
1 parent 24dc232 commit ad33d73

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ However, if you're working with Docker versions as old as 18.09, you can still e
3636

3737
## Features:
3838
- [INCLUDE](#include): Incorporate content as is from other Dockerfiles or snippets.
39+
- [INCLUDE_ARGS](#include_args): Converts a `.env` file into Dockerfile `ARG` instructions.
40+
- [INCLUDE_ENVS](#include_envs): Converts a `.env` file into Dockerfile `ENV` instructions.
41+
- [INCLUDE_LABELS](#include_labels): Converts a `.env` file into Dockerfile `LABEL` instructions.
3942
- [FROM](#from):
4043
- [FROM with Relative Paths](#from-with-relative-paths): Use other Dockerfiles as a base using relative paths.
4144
- [FROM with Stages](#from-with-stages): Reference specific stages from other Dockerfiles.
@@ -114,6 +117,75 @@ Easily include content from another Dockerfile or snippet, ensuring straightforw
114117
INCLUDE ./path/to/another/dockerfile
115118
```
116119

120+
### INCLUDE_ARGS
121+
122+
Converts key-value pairs from a `.env` file into Dockerfile `ARG` instructions.
123+
Use this to expose build-time variables without hardcoding them into the Dockerfile.
124+
125+
```text
126+
# custom-args.env
127+
NODE_VERSION=20.11.1
128+
PNPM_VERSION=9.1.0
129+
```
130+
131+
```Dockerfile
132+
# Include key-value pairs from file
133+
INCLUDE_ARGS ./path/to/custom-args.env
134+
```
135+
136+
This expands to:
137+
```Dockerfile
138+
ARG NODE_VERSION="20.11.1"
139+
ARG PNPM_VERSION="9.1.0"
140+
```
141+
142+
**Note:** Values can be overridden at build time with `--build-arg` if desired.
143+
144+
### INCLUDE_ENVS
145+
146+
Converts key-value pairs from a `.env` file into Dockerfile `ENV` instructions.
147+
Ideal for runtime configuration baked into the image.
148+
149+
```text
150+
# custom-envvars.env
151+
NODE_ENV=production
152+
APP_PORT=8080
153+
```
154+
155+
```Dockerfile
156+
# Include key-value pairs from file
157+
INCLUDE_ENVS ./path/to/custom-envvars.env
158+
```
159+
160+
This expands to:
161+
```Dockerfile
162+
ENV NODE_ENV="production"
163+
ENV APP_PORT="8080"
164+
```
165+
166+
### INCLUDE_LABELS
167+
Converts key-value pairs from a `.env` file into Dockerfile `LABEL` instructions.
168+
Useful for image metadata (e.g., authorship, version, VCS refs).
169+
170+
```text
171+
# custom-labels.env
172+
org.opencontainers.image.title=myapp
173+
org.opencontainers.image.version=1.2.3
174+
org.opencontainers.image.revision=abc1234
175+
```
176+
177+
```Dockerfile
178+
# Include key-value pairs from file
179+
INCLUDE_LABELS ./path/to/custom-labels.env
180+
```
181+
182+
This expands to:
183+
```Dockerfile
184+
LABEL org.opencontainers.image.title="myapp"
185+
LABEL org.opencontainers.image.version="1.2.3"
186+
LABEL org.opencontainers.image.revision="abc1234"
187+
```
188+
117189
### FROM
118190

119191
#### FROM with Relative Paths

0 commit comments

Comments
 (0)