Skip to content

Commit 88b20f4

Browse files
author
Natalie Arellano
committed
Add platform migration guide
Signed-off-by: Natalie Arellano <[email protected]>
1 parent 9651504 commit 88b20f4

File tree

2 files changed

+85
-18
lines changed

2 files changed

+85
-18
lines changed

content/docs/features/dockerfiles.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,7 @@ An image extension could be defined with the following directory:
5050
## A platform's perspective
5151

5252
Platforms may wish to use image extensions if they wish to provide the flexibility of modifying base images dynamically
53-
at build time.
54-
55-
To use image extensions, a platform should do the following:
56-
57-
* Ensure the platform API in use is at least `0.10`; image extensions were introduced in API version `0.10`
58-
* Include image extensions in the provided builder
59-
* When invoking the `detector` binary, include image extensions in `order.toml`
60-
* Note that the new `generate` phase is a sub-task of the `detector` and thus happens automatically after (and in the
61-
same container as) `detect`
62-
* Invoke the `restorer` with the `-build-image` flag and cache volume mounted at `/kaniko`
63-
* The `restorer` will gather data from the registry that is necessary for builder image extension
64-
* Invoke the `extender` binary with the builder image digest reference as the first argument and cache volume mounted
65-
at `/kaniko`
66-
* Note that when extending the builder image, there is no need to invoke the `builder` binary as the `build` phase is
67-
a sub-task of the `extender` and thus happens automatically after (and in the same container as) `extend`
68-
* Invoke the `exporter` as usual
69-
70-
Extensions workflows are not currently supported when using the `creator` binary - support may be added in the future.
53+
at build time. For more information, consult the [migration guide][TODO].
7154

7255
### Risks
7356

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
+++
2+
title="Platform API 0.9 -> 0.10"
3+
+++
4+
5+
<!--more-->
6+
7+
This guide is most relevant to platform operators.
8+
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.10) for platform API 0.10 for the full list of changes and further details.
10+
11+
## Platform Operator
12+
13+
### The `launcher` supports overridable process args
14+
15+
The way user-provided arguments are handled by the launcher depends on the buildpack API of the buildpack that created the process definition.
16+
17+
#### Newer buildpacks
18+
19+
Process types contributed by newer buildpacks (buildpack API 0.9 and above) may have overridable process arguments. Looking at metadata.toml:
20+
```
21+
[[processes]]
22+
type = "from-newer-buildpack"
23+
command = ["some-command", "always-1", "always-2"]
24+
args = ["override-1", "override-2"]
25+
```
26+
27+
`always-1` and `always-2` are arguments that are always provided to `some-command`. If no user-provided arguments are specified when the application image is launched, `override-1` and `override-2` will also be provided. If user-provided arguments are specified, these will be provided **instead of** `override-1` and `override-2`. Example:
28+
29+
```
30+
docker run --entrypoint from-newer-buildpack my-image
31+
```
32+
33+
will result in the following command invocation: `some-command always-1 always-2 override-1 override-2`. However:
34+
35+
```
36+
docker run --entrypoint from-newer-buildpack my-image user-1 user-2
37+
```
38+
39+
will result in the following command invocation: `some-command always-1 always-2 user-1 user-2`.
40+
41+
#### Older buildpacks
42+
43+
Process types contributed by older buildpacks (buildpack API 0.8 and below) do not have overridable process arguments. Looking at metadata.toml:
44+
```
45+
[[processes]]
46+
type = "from-older-buildpack"
47+
command = ["some-command"]
48+
args = ["always-1", "always-2"]
49+
```
50+
51+
The `command` list will never have more than one entry. `always-1` and `always-2` are arguments that are always provided to `some-command`. If no user-provided arguments are specified when the application image is launched, `always-1` and `always-2` will be provided only. If user-provided arguments are specified, these will be **appended** to the `args` list. Example:
52+
53+
```
54+
docker run --entrypoint from-newer-buildpack my-image
55+
```
56+
57+
will result in the following command invocation: `some-command always-1 always-2`. However:
58+
59+
```
60+
docker run --entrypoint from-older-buildpack my-image user-1 user-2
61+
```
62+
63+
will result in the following command invocation: `some-command always-1 always-2 user-1 user-2`.
64+
65+
### Image extensions are supported (experimental)
66+
67+
Platform 0.10 introduces image extensions as experimental components for customizing build and run-time base images (see [here][TODO] for more information). Image extensions output Dockerfiles which are applied by the lifecycle using [kaniko][https://github.com/GoogleContainerTools/kaniko], a tool for building container images in Kubernetes, as a library.
68+
69+
Note: image extensions are not supported for Windows container images.
70+
71+
* To create a builder with extensions, ensure the `pack` version in use is at least TODO and enable experimental features: `pack config experimental`.
72+
* Invoke `analyzer` as usual
73+
* Invoke `detector` with a new optional argument: `-generated`, to specify the directory where Dockerfiles generated by image extensions will be output (defaults to `<layers>/generated`) and include image extensions in `order.toml`
74+
* Dockerfiles for customizing the build image can be found in `<generated>/build/<image extension ID>/Dockerfile`
75+
* Dockerfiles for customizing the run image can be found in `<generated>/run/<image extension ID>/Dockerfile`
76+
* The new run image will be written to `analyzed.toml`
77+
* Invoke `restorer` with a new required argument (when using extensions): `-build-image`, a tag reference to the builder image in use
78+
* A new volume mount is introduced with target `/kaniko`; this volume must be writable by the `restorer` user
79+
* Invoke `extender` (new lifecycle binary) as _root_ instead of `builder`; the extender will use kaniko to apply the relevant generated Dockerfiles to the build image and then drop privileges to run the `build` phase
80+
* The same volume from `restore` should be mounted at `/kaniko`
81+
* Invoke `exporter` as usual
82+
* If Dockerfiles for customizing the run image were output by extensions, the `exporter` will use the run image designated by the extension process
83+
84+
Extensions workflows are not currently supported when using the `creator` binary, though support may be added in the future.

0 commit comments

Comments
 (0)