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
Copy file name to clipboardExpand all lines: docs/pages_en/usage/build/images.md
+91Lines changed: 91 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -382,6 +382,97 @@ import:
382
382
383
383
For more info on how to write Stapel instructions refer to the [documentation]({{"usage/build/stapel/base.html" | true_relative_url }}).
384
384
385
+
## Changing image configuration spec
386
+
387
+
In OCI (Open Container Initiative), [image configuration spec](https://github.com/opencontainers/image-spec/blob/main/config.md) is the image specification that describes its structure and metadata. The `imageSpec` directive in `werf.yaml` provides flexible options for managing and configuring various aspects of images:
388
+
389
+
- Flexibility in managing specification fields.
390
+
- Removal or resetting of unnecessary components: labels, environment variables, volumes, commands, and build history.
391
+
- A unified configuration mechanism for all supported backends and syntaxes.
392
+
- Rules that apply both to all images in a project and to individual images.
393
+
394
+
### Global configuration
395
+
396
+
Example configuration that will apply to all images in the project:
> **Note:** Configuration for a specific image takes precedence over global configuration. String values will be overwritten, and for multi-valued directives, the data will be merged based on priority.
453
+
454
+
### Build process changes
455
+
456
+
Changing the image configuration does not directly affect the build process but allows you to configure aspects such as removing unnecessary volumes or adding environment variables for the base image. Example:
457
+
458
+
```yaml
459
+
image: base
460
+
from: postgres:12.22-bookworm
461
+
imageSpec:
462
+
config:
463
+
removeVolumes:
464
+
- "/var/lib/postgresql/data"
465
+
---
466
+
image: app
467
+
fromImage: base
468
+
git:
469
+
add: /postgresql/data
470
+
to: /var/lib/postgresql/data
471
+
```
472
+
473
+
In this example, the base image `postgres:12.22-bookworm` has unnecessary volumes removed, which can then be used in the `app` image.
> The `docker` directive is deprecated and will be removed in v3. Please use the `imageSpec` directive instead. Read more about the `imageSpec` directive [here]({{ "usage/build/images.html#changing-image-configuration-spec" | true_relative_url }}).
9
+
8
10
[Dockerfile instructions](https://docs.docker.com/engine/reference/builder/) can be divided into two groups: build-time instructions and other instructions affecting an image manifest. Build-time instructions do not make sense in a werf build process. Thus, werf supports only following instructions:
9
11
10
12
*`USER` to set the user name (or UID) and optionally the user group (or GID) (read more [here](https://docs.docker.com/engine/reference/builder/#user)).
0 commit comments