Skip to content

Commit a424337

Browse files
committed
Document environment variable usage
1 parent bea6327 commit a424337

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,39 @@ steps:
105105
- docker#v3.8.0
106106
```
107107

108+
### Building on the resulting image
109+
110+
The resulting image are exported as environment variables:
111+
112+
- `BUILDKITE_PLUGIN_DOCKER_IMAGE` (or whatever is specified per [changing the name of exported variable](#changing-the-name-of-exported-variable)) for the combined `image:tag` value
113+
- `BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE` for the `image` by itself
114+
- `BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG` for the `tag` by itself
115+
116+
These variables can be used by subsequent plugins and commands in the same build step.
117+
For example, you may have a command that propagates these variables to another Docker build command:
118+
119+
```yaml
120+
steps:
121+
- command: >-
122+
docker build
123+
--build-arg BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE
124+
--build-arg BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG
125+
--file Dockerfile.secondary
126+
plugins:
127+
- seek-oss/docker-ecr-cache#v1.10.0
128+
```
129+
130+
Your `Dockerfile.secondary` can then [dynamically use these args](https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact):
131+
132+
```dockerfile
133+
ARG BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE
134+
ARG BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG
135+
136+
FROM ${BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE}:${BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG}
137+
138+
RUN echo wow
139+
```
140+
108141
### Specifying a target step
109142

110143
A [multi-stage Docker build] can be used to reduce an application container to

0 commit comments

Comments
 (0)