Add support for untrusted CNB builders
A `trustBuilder` configuration option has been added to the Maven and Gradle CNB integration image building goal and task. A known set of builders published by Paketo, Heroku, and Google are trusted by default, all other builders are untrusted by default. Closes gh-41352
This commit is contained in:
@@ -45,9 +45,20 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class BuildRequest {
|
||||
|
||||
static final String DEFAULT_BUILDER_IMAGE_NAME = "paketobuildpacks/builder-jammy-tiny:latest";
|
||||
static final String DEFAULT_BUILDER_IMAGE_NAME = "paketobuildpacks/builder-jammy-tiny";
|
||||
|
||||
private static final ImageReference DEFAULT_BUILDER = ImageReference.of(DEFAULT_BUILDER_IMAGE_NAME);
|
||||
static final String DEFAULT_BUILDER_IMAGE_REF = DEFAULT_BUILDER_IMAGE_NAME + ":latest";
|
||||
|
||||
static final List<ImageReference> KNOWN_TRUSTED_BUILDERS = List.of(
|
||||
ImageReference.of("paketobuildpacks/builder-jammy-tiny"),
|
||||
ImageReference.of("paketobuildpacks/builder-jammy-base"),
|
||||
ImageReference.of("paketobuildpacks/builder-jammy-full"),
|
||||
ImageReference.of("paketobuildpacks/builder-jammy-buildpackless-tiny"),
|
||||
ImageReference.of("paketobuildpacks/builder-jammy-buildpackless-base"),
|
||||
ImageReference.of("paketobuildpacks/builder-jammy-buildpackless-full"),
|
||||
ImageReference.of("gcr.io/buildpacks/builder"), ImageReference.of("heroku/builder"));
|
||||
|
||||
private static final ImageReference DEFAULT_BUILDER = ImageReference.of(DEFAULT_BUILDER_IMAGE_REF);
|
||||
|
||||
private final ImageReference name;
|
||||
|
||||
@@ -55,6 +66,8 @@ public class BuildRequest {
|
||||
|
||||
private final ImageReference builder;
|
||||
|
||||
private final Boolean trustBuilder;
|
||||
|
||||
private final ImageReference runImage;
|
||||
|
||||
private final Creator creator;
|
||||
@@ -95,6 +108,7 @@ public class BuildRequest {
|
||||
this.name = name.inTaggedForm();
|
||||
this.applicationContent = applicationContent;
|
||||
this.builder = DEFAULT_BUILDER;
|
||||
this.trustBuilder = null;
|
||||
this.runImage = null;
|
||||
this.env = Collections.emptyMap();
|
||||
this.cleanCache = false;
|
||||
@@ -118,7 +132,8 @@ public class BuildRequest {
|
||||
ImageReference runImage, Creator creator, Map<String, String> env, boolean cleanCache,
|
||||
boolean verboseLogging, PullPolicy pullPolicy, boolean publish, List<BuildpackReference> buildpacks,
|
||||
List<Binding> bindings, String network, List<ImageReference> tags, Cache buildWorkspace, Cache buildCache,
|
||||
Cache launchCache, Instant createdDate, String applicationDirectory, List<String> securityOptions) {
|
||||
Cache launchCache, Instant createdDate, String applicationDirectory, List<String> securityOptions,
|
||||
Boolean trustBuilder) {
|
||||
this.name = name;
|
||||
this.applicationContent = applicationContent;
|
||||
this.builder = builder;
|
||||
@@ -139,6 +154,7 @@ public class BuildRequest {
|
||||
this.createdDate = createdDate;
|
||||
this.applicationDirectory = applicationDirectory;
|
||||
this.securityOptions = securityOptions;
|
||||
this.trustBuilder = trustBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +167,20 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, builder.inTaggedOrDigestForm(), this.runImage,
|
||||
this.creator, this.env, this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish,
|
||||
this.buildpacks, this.bindings, this.network, this.tags, this.buildWorkspace, this.buildCache,
|
||||
this.launchCache, this.createdDate, this.applicationDirectory, this.securityOptions);
|
||||
this.launchCache, this.createdDate, this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new {@link BuildRequest} with an updated trust builder setting.
|
||||
* @param trustBuilder {@code true} if the builder should be treated as trusted,
|
||||
* {@code false} otherwise
|
||||
* @return an updated build request
|
||||
*/
|
||||
public BuildRequest withTrustBuilder(boolean trustBuilder) {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions, trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,7 +192,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, runImageName.inTaggedOrDigestForm(),
|
||||
this.creator, this.env, this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish,
|
||||
this.buildpacks, this.bindings, this.network, this.tags, this.buildWorkspace, this.buildCache,
|
||||
this.launchCache, this.createdDate, this.applicationDirectory, this.securityOptions);
|
||||
this.launchCache, this.createdDate, this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,7 +205,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,7 +222,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator,
|
||||
Collections.unmodifiableMap(env), this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish,
|
||||
this.buildpacks, this.bindings, this.network, this.tags, this.buildWorkspace, this.buildCache,
|
||||
this.launchCache, this.createdDate, this.applicationDirectory, this.securityOptions);
|
||||
this.launchCache, this.createdDate, this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +237,8 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator,
|
||||
Collections.unmodifiableMap(updatedEnv), this.cleanCache, this.verboseLogging, this.pullPolicy,
|
||||
this.publish, this.buildpacks, this.bindings, this.network, this.tags, this.buildWorkspace,
|
||||
this.buildCache, this.launchCache, this.createdDate, this.applicationDirectory, this.securityOptions);
|
||||
this.buildCache, this.launchCache, this.createdDate, this.applicationDirectory, this.securityOptions,
|
||||
this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +250,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +262,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,7 +274,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,7 +286,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,7 +311,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,7 +336,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,7 +349,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,7 +372,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -356,7 +386,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -369,7 +399,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -382,7 +412,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, launchCache, this.createdDate,
|
||||
this.applicationDirectory, this.securityOptions);
|
||||
this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,7 +425,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache,
|
||||
parseCreatedDate(createdDate), this.applicationDirectory, this.securityOptions);
|
||||
parseCreatedDate(createdDate), this.applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
private Instant parseCreatedDate(String createdDate) {
|
||||
@@ -420,7 +450,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
applicationDirectory, this.securityOptions);
|
||||
applicationDirectory, this.securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,7 +464,7 @@ public class BuildRequest {
|
||||
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,
|
||||
this.cleanCache, this.verboseLogging, this.pullPolicy, this.publish, this.buildpacks, this.bindings,
|
||||
this.network, this.tags, this.buildWorkspace, this.buildCache, this.launchCache, this.createdDate,
|
||||
this.applicationDirectory, securityOptions);
|
||||
this.applicationDirectory, securityOptions, this.trustBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -464,6 +494,19 @@ public class BuildRequest {
|
||||
return this.builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the builder should be treated as trusted.
|
||||
* @return the trust builder flag
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public boolean isTrustBuilder() {
|
||||
return (this.trustBuilder != null) ? this.trustBuilder : isBuilderKnownAndTrusted();
|
||||
}
|
||||
|
||||
private boolean isBuilderKnownAndTrusted() {
|
||||
return KNOWN_TRUSTED_BUILDERS.stream().anyMatch((builder) -> builder.getName().equals(this.builder.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the run image that should be used, if provided.
|
||||
* @return the run image
|
||||
|
||||
@@ -161,43 +161,104 @@ class Lifecycle implements Closeable {
|
||||
if (this.request.isCleanCache()) {
|
||||
deleteCache(this.buildCache);
|
||||
}
|
||||
run(createPhase());
|
||||
if (this.request.isTrustBuilder()) {
|
||||
run(createPhase());
|
||||
}
|
||||
else {
|
||||
run(analyzePhase());
|
||||
run(detectPhase());
|
||||
if (!this.request.isCleanCache()) {
|
||||
run(restorePhase());
|
||||
}
|
||||
else {
|
||||
this.log.skippingPhase("restorer", "because 'cleanCache' is enabled");
|
||||
}
|
||||
run(buildPhase());
|
||||
run(exportPhase());
|
||||
}
|
||||
this.log.executedLifecycle(this.request);
|
||||
}
|
||||
|
||||
private Phase createPhase() {
|
||||
Phase phase = new Phase("creator", isVerboseLogging());
|
||||
phase.withDaemonAccess();
|
||||
phase.withApp(this.applicationDirectory,
|
||||
Binding.from(getCacheBindingSource(this.application), this.applicationDirectory));
|
||||
phase.withPlatform(Directory.PLATFORM);
|
||||
phase.withRunImage(this.request.getRunImage());
|
||||
phase.withLayers(Directory.LAYERS, Binding.from(getCacheBindingSource(this.layers), Directory.LAYERS));
|
||||
phase.withBuildCache(Directory.CACHE, Binding.from(getCacheBindingSource(this.buildCache), Directory.CACHE));
|
||||
phase.withLaunchCache(Directory.LAUNCH_CACHE,
|
||||
Binding.from(getCacheBindingSource(this.launchCache), Directory.LAUNCH_CACHE));
|
||||
configureDaemonAccess(phase);
|
||||
phase.withLogLevelArg();
|
||||
phase.withArgs("-app", this.applicationDirectory);
|
||||
phase.withArgs("-platform", Directory.PLATFORM);
|
||||
phase.withArgs("-run-image", this.request.getRunImage());
|
||||
phase.withArgs("-layers", Directory.LAYERS);
|
||||
phase.withArgs("-cache-dir", Directory.CACHE);
|
||||
phase.withArgs("-launch-cache", Directory.LAUNCH_CACHE);
|
||||
phase.withArgs("-daemon");
|
||||
if (this.request.isCleanCache()) {
|
||||
phase.withArgs("-skip-restore");
|
||||
phase.withSkipRestore();
|
||||
}
|
||||
if (requiresProcessTypeDefault()) {
|
||||
phase.withArgs("-process-type=web");
|
||||
phase.withProcessType("web");
|
||||
}
|
||||
phase.withArgs(this.request.getName());
|
||||
phase.withBinding(Binding.from(getCacheBindingSource(this.layers), Directory.LAYERS));
|
||||
phase.withBinding(Binding.from(getCacheBindingSource(this.application), this.applicationDirectory));
|
||||
phase.withBinding(Binding.from(getCacheBindingSource(this.buildCache), Directory.CACHE));
|
||||
phase.withBinding(Binding.from(getCacheBindingSource(this.launchCache), Directory.LAUNCH_CACHE));
|
||||
if (this.request.getBindings() != null) {
|
||||
this.request.getBindings().forEach(phase::withBinding);
|
||||
}
|
||||
phase.withEnv(PLATFORM_API_VERSION_KEY, this.platformVersion.toString());
|
||||
if (this.request.getNetwork() != null) {
|
||||
phase.withNetworkMode(this.request.getNetwork());
|
||||
}
|
||||
if (this.request.getCreatedDate() != null) {
|
||||
phase.withEnv(SOURCE_DATE_EPOCH_KEY, Long.toString(this.request.getCreatedDate().getEpochSecond()));
|
||||
phase.withImageName(this.request.getName());
|
||||
configureOptions(phase);
|
||||
configureCreatedDate(phase);
|
||||
return phase;
|
||||
|
||||
}
|
||||
|
||||
private Phase analyzePhase() {
|
||||
Phase phase = new Phase("analyzer", isVerboseLogging());
|
||||
configureDaemonAccess(phase);
|
||||
phase.withLaunchCache(Directory.LAUNCH_CACHE,
|
||||
Binding.from(getCacheBindingSource(this.launchCache), Directory.LAUNCH_CACHE));
|
||||
phase.withLayers(Directory.LAYERS, Binding.from(getCacheBindingSource(this.layers), Directory.LAYERS));
|
||||
phase.withRunImage(this.request.getRunImage());
|
||||
phase.withImageName(this.request.getName());
|
||||
configureOptions(phase);
|
||||
return phase;
|
||||
}
|
||||
|
||||
private Phase detectPhase() {
|
||||
Phase phase = new Phase("detector", isVerboseLogging());
|
||||
phase.withApp(this.applicationDirectory,
|
||||
Binding.from(getCacheBindingSource(this.application), this.applicationDirectory));
|
||||
phase.withLayers(Directory.LAYERS, Binding.from(getCacheBindingSource(this.layers), Directory.LAYERS));
|
||||
phase.withPlatform(Directory.PLATFORM);
|
||||
configureOptions(phase);
|
||||
return phase;
|
||||
}
|
||||
|
||||
private Phase restorePhase() {
|
||||
Phase phase = new Phase("restorer", isVerboseLogging());
|
||||
configureDaemonAccess(phase);
|
||||
phase.withBuildCache(Directory.CACHE, Binding.from(getCacheBindingSource(this.buildCache), Directory.CACHE));
|
||||
phase.withLayers(Directory.LAYERS, Binding.from(getCacheBindingSource(this.layers), Directory.LAYERS));
|
||||
configureOptions(phase);
|
||||
return phase;
|
||||
}
|
||||
|
||||
private Phase buildPhase() {
|
||||
Phase phase = new Phase("builder", isVerboseLogging());
|
||||
phase.withApp(this.applicationDirectory,
|
||||
Binding.from(getCacheBindingSource(this.application), this.applicationDirectory));
|
||||
phase.withLayers(Directory.LAYERS, Binding.from(getCacheBindingSource(this.layers), Directory.LAYERS));
|
||||
phase.withPlatform(Directory.PLATFORM);
|
||||
configureOptions(phase);
|
||||
return phase;
|
||||
}
|
||||
|
||||
private Phase exportPhase() {
|
||||
Phase phase = new Phase("exporter", isVerboseLogging());
|
||||
configureDaemonAccess(phase);
|
||||
phase.withApp(this.applicationDirectory,
|
||||
Binding.from(getCacheBindingSource(this.application), this.applicationDirectory));
|
||||
phase.withBuildCache(Directory.CACHE, Binding.from(getCacheBindingSource(this.buildCache), Directory.CACHE));
|
||||
phase.withLaunchCache(Directory.LAUNCH_CACHE,
|
||||
Binding.from(getCacheBindingSource(this.launchCache), Directory.LAUNCH_CACHE));
|
||||
phase.withLayers(Directory.LAYERS, Binding.from(getCacheBindingSource(this.layers), Directory.LAYERS));
|
||||
if (requiresProcessTypeDefault()) {
|
||||
phase.withProcessType("web");
|
||||
}
|
||||
phase.withImageName(this.request.getName());
|
||||
configureOptions(phase);
|
||||
configureCreatedDate(phase);
|
||||
return phase;
|
||||
}
|
||||
|
||||
@@ -238,6 +299,7 @@ class Lifecycle implements Closeable {
|
||||
}
|
||||
|
||||
private void configureDaemonAccess(Phase phase) {
|
||||
phase.withDaemonAccess();
|
||||
if (this.dockerHost != null) {
|
||||
if (this.dockerHost.isRemote()) {
|
||||
phase.withEnv("DOCKER_HOST", this.dockerHost.getAddress());
|
||||
@@ -258,6 +320,22 @@ class Lifecycle implements Closeable {
|
||||
}
|
||||
}
|
||||
|
||||
private void configureCreatedDate(Phase phase) {
|
||||
if (this.request.getCreatedDate() != null) {
|
||||
phase.withEnv(SOURCE_DATE_EPOCH_KEY, Long.toString(this.request.getCreatedDate().getEpochSecond()));
|
||||
}
|
||||
}
|
||||
|
||||
private void configureOptions(Phase phase) {
|
||||
if (this.request.getBindings() != null) {
|
||||
this.request.getBindings().forEach(phase::withBinding);
|
||||
}
|
||||
if (this.request.getNetwork() != null) {
|
||||
phase.withNetworkMode(this.request.getNetwork());
|
||||
}
|
||||
phase.withEnv(PLATFORM_API_VERSION_KEY, this.platformVersion.toString());
|
||||
}
|
||||
|
||||
private boolean isVerboseLogging() {
|
||||
return this.request.isVerboseLogging() && this.lifecycleVersion.isEqualOrGreaterThan(LOGGING_MINIMUM_VERSION);
|
||||
}
|
||||
@@ -269,7 +347,7 @@ class Lifecycle implements Closeable {
|
||||
private void run(Phase phase) throws IOException {
|
||||
Consumer<LogUpdateEvent> logConsumer = this.log.runningPhase(this.request, phase.getName());
|
||||
ContainerConfig containerConfig = ContainerConfig.of(this.builder.getName(), phase::apply);
|
||||
ContainerReference reference = createContainer(containerConfig);
|
||||
ContainerReference reference = createContainer(containerConfig, phase.requiresApp());
|
||||
try {
|
||||
this.docker.container().start(reference);
|
||||
this.docker.container().logs(reference, logConsumer::accept);
|
||||
@@ -283,8 +361,8 @@ class Lifecycle implements Closeable {
|
||||
}
|
||||
}
|
||||
|
||||
private ContainerReference createContainer(ContainerConfig config) throws IOException {
|
||||
if (this.applicationVolumePopulated) {
|
||||
private ContainerReference createContainer(ContainerConfig config, boolean requiresAppUpload) throws IOException {
|
||||
if (!requiresAppUpload || this.applicationVolumePopulated) {
|
||||
return this.docker.container().create(config);
|
||||
}
|
||||
try {
|
||||
@@ -339,8 +417,7 @@ class Lifecycle implements Closeable {
|
||||
* <p>
|
||||
* Maps to the {@code <layers...>} concept in the
|
||||
* <a href="https://github.com/buildpacks/spec/blob/master/buildpack.md">buildpack
|
||||
* specification</a> and the {@code -layers} argument from the reference lifecycle
|
||||
* implementation.
|
||||
* specification</a> and the {@code -layers} argument to lifecycle phases.
|
||||
*/
|
||||
static final String LAYERS = "/layers";
|
||||
|
||||
@@ -367,8 +444,7 @@ class Lifecycle implements Closeable {
|
||||
* <p>
|
||||
* Maps to the {@code <platform>/env} and {@code <platform>/#} concepts in the
|
||||
* <a href="https://github.com/buildpacks/spec/blob/master/buildpack.md">buildpack
|
||||
* specification</a> and the {@code -platform} argument from the reference
|
||||
* lifecycle implementation.
|
||||
* specification</a> and the {@code -platform} argument to lifecycle phases.
|
||||
*/
|
||||
static final String PLATFORM = "/platform";
|
||||
|
||||
@@ -377,8 +453,7 @@ class Lifecycle implements Closeable {
|
||||
* image {@link BuildRequest#getName() name} being built, and is persistent across
|
||||
* invocations even if the application content has changed.
|
||||
* <p>
|
||||
* Maps to the {@code -path} argument from the reference lifecycle implementation
|
||||
* cache and restore phases
|
||||
* Maps to the {@code -path} argument to lifecycle phases.
|
||||
*/
|
||||
static final String CACHE = "/cache";
|
||||
|
||||
@@ -387,8 +462,7 @@ class Lifecycle implements Closeable {
|
||||
* based on the image {@link BuildRequest#getName() name} being built, and is
|
||||
* persistent across invocations even if the application content has changed.
|
||||
* <p>
|
||||
* Maps to the {@code -launch-cache} argument from the reference lifecycle
|
||||
* implementation export phase
|
||||
* Maps to the {@code -launch-cache} argument to lifecycle phases.
|
||||
*/
|
||||
static final String LAUNCH_CACHE = "/launch-cache";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.boot.buildpack.platform.docker.type.Binding;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ContainerConfig;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImageReference;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -37,8 +38,6 @@ class Phase {
|
||||
|
||||
private final String name;
|
||||
|
||||
private final boolean verboseLogging;
|
||||
|
||||
private boolean daemonAccess = false;
|
||||
|
||||
private final List<String> args = new ArrayList<>();
|
||||
@@ -51,6 +50,8 @@ class Phase {
|
||||
|
||||
private String networkMode;
|
||||
|
||||
private boolean requiresApp = false;
|
||||
|
||||
/**
|
||||
* Create a new {@link Phase} instance.
|
||||
* @param name the name of the phase
|
||||
@@ -58,22 +59,65 @@ class Phase {
|
||||
*/
|
||||
Phase(String name, boolean verboseLogging) {
|
||||
this.name = name;
|
||||
this.verboseLogging = verboseLogging;
|
||||
withLogLevelArg(verboseLogging);
|
||||
}
|
||||
|
||||
void withApp(String path, Binding binding) {
|
||||
withArgs("-app", path);
|
||||
withBinding(binding);
|
||||
this.requiresApp = true;
|
||||
}
|
||||
|
||||
void withBuildCache(String path, Binding binding) {
|
||||
withArgs("-cache-dir", path);
|
||||
withBinding(binding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update this phase with Docker daemon access.
|
||||
*/
|
||||
void withDaemonAccess() {
|
||||
this.withArgs("-daemon");
|
||||
this.daemonAccess = true;
|
||||
}
|
||||
|
||||
void withImageName(ImageReference imageName) {
|
||||
withArgs(imageName);
|
||||
}
|
||||
|
||||
void withLaunchCache(String path, Binding binding) {
|
||||
withArgs("-launch-cache", path);
|
||||
withBinding(binding);
|
||||
}
|
||||
|
||||
void withLayers(String path, Binding binding) {
|
||||
withArgs("-layers", path);
|
||||
withBinding(binding);
|
||||
}
|
||||
|
||||
void withPlatform(String path) {
|
||||
withArgs("-platform", path);
|
||||
}
|
||||
|
||||
void withProcessType(String type) {
|
||||
withArgs("-process-type", type);
|
||||
}
|
||||
|
||||
void withRunImage(ImageReference runImage) {
|
||||
withArgs("-run-image", runImage);
|
||||
}
|
||||
|
||||
void withSkipRestore() {
|
||||
withArgs("-skip-restore");
|
||||
}
|
||||
|
||||
/**
|
||||
* Update this phase with a debug log level arguments if verbose logging has been
|
||||
* requested.
|
||||
* @param verboseLogging if verbose logging is requested
|
||||
*/
|
||||
void withLogLevelArg() {
|
||||
if (this.verboseLogging) {
|
||||
private void withLogLevelArg(boolean verboseLogging) {
|
||||
if (verboseLogging) {
|
||||
this.args.add("-log-level");
|
||||
this.args.add("debug");
|
||||
}
|
||||
@@ -128,6 +172,10 @@ class Phase {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
boolean requiresApp() {
|
||||
return this.requiresApp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,14 +27,18 @@ import java.time.ZoneId;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import org.springframework.boot.buildpack.platform.docker.type.Binding;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImageName;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImageReference;
|
||||
import org.springframework.boot.buildpack.platform.io.Owner;
|
||||
import org.springframework.boot.buildpack.platform.io.TarArchive;
|
||||
@@ -64,7 +68,7 @@ class BuildRequestTests {
|
||||
writeTestJarFile(jarFile);
|
||||
BuildRequest request = BuildRequest.forJarFile(jarFile);
|
||||
assertThat(request.getName()).hasToString("docker.io/library/my-app:0.0.1");
|
||||
assertThat(request.getBuilder()).hasToString("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_NAME);
|
||||
assertThat(request.getBuilder()).hasToString("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_REF);
|
||||
assertThat(request.getApplicationContent(Owner.ROOT)).satisfies(this::hasExpectedJarContent);
|
||||
assertThat(request.getEnv()).isEmpty();
|
||||
}
|
||||
@@ -75,7 +79,7 @@ class BuildRequestTests {
|
||||
writeTestJarFile(jarFile);
|
||||
BuildRequest request = BuildRequest.forJarFile(ImageReference.of("test-app"), jarFile);
|
||||
assertThat(request.getName()).hasToString("docker.io/library/test-app:latest");
|
||||
assertThat(request.getBuilder()).hasToString("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_NAME);
|
||||
assertThat(request.getBuilder()).hasToString("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_REF);
|
||||
assertThat(request.getApplicationContent(Owner.ROOT)).satisfies(this::hasExpectedJarContent);
|
||||
assertThat(request.getEnv()).isEmpty();
|
||||
}
|
||||
@@ -104,6 +108,7 @@ class BuildRequestTests {
|
||||
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"))
|
||||
.withBuilder(ImageReference.of("spring/builder"));
|
||||
assertThat(request.getBuilder()).hasToString("docker.io/spring/builder:latest");
|
||||
assertThat(request.isTrustBuilder()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -113,6 +118,53 @@ class BuildRequestTests {
|
||||
.of("spring/builder@sha256:6e9f67fa63b0323e9a1e587fd71c561ba48a034504fb804fd26fd8800039835d"));
|
||||
assertThat(request.getBuilder()).hasToString(
|
||||
"docker.io/spring/builder@sha256:6e9f67fa63b0323e9a1e587fd71c561ba48a034504fb804fd26fd8800039835d");
|
||||
assertThat(request.isTrustBuilder()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void withoutBuilderTrustsDefaultBuilder() throws IOException {
|
||||
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));
|
||||
assertThat(request.isTrustBuilder()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void withoutBuilderTrustsDefaultBuilderWithDifferentTag() throws IOException {
|
||||
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"))
|
||||
.withBuilder(ImageReference.of(ImageName.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME), "other"));
|
||||
assertThat(request.isTrustBuilder()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void withoutBuilderTrustsDefaultBuilderWithDigest() throws IOException {
|
||||
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"))
|
||||
.withBuilder(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)
|
||||
.withDigest("sha256:6e9f67fa63b0323e9a1e587fd71c561ba48a034504fb804fd26fd8800039835d"));
|
||||
assertThat(request.isTrustBuilder()).isTrue();
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("trustedBuilders")
|
||||
void withKnownTrustedBuilderTrustsBuilder(ImageReference builder) throws IOException {
|
||||
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar")).withBuilder(builder);
|
||||
assertThat(request.isTrustBuilder()).isTrue();
|
||||
}
|
||||
|
||||
static Stream<ImageReference> trustedBuilders() {
|
||||
return BuildRequest.KNOWN_TRUSTED_BUILDERS.stream();
|
||||
}
|
||||
|
||||
@Test
|
||||
void withoutTrustBuilderAndDefaultBuilderUpdatesTrustsBuilder() throws IOException {
|
||||
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar")).withTrustBuilder(false);
|
||||
assertThat(request.isTrustBuilder()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void withTrustBuilderAndBuilderUpdatesTrustBuilder() throws IOException {
|
||||
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"))
|
||||
.withBuilder(ImageReference.of("spring/builder"))
|
||||
.withTrustBuilder(true);
|
||||
assertThat(request.isTrustBuilder()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -86,7 +86,7 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
@@ -97,7 +97,7 @@ class BuilderTests {
|
||||
assertThat(out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
ArgumentCaptor<ImageArchive> archive = ArgumentCaptor.forClass(ImageArchive.class);
|
||||
then(docker.image()).should()
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull());
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull());
|
||||
then(docker.image()).should()
|
||||
.pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull());
|
||||
then(docker.image()).should().load(archive.capture(), any());
|
||||
@@ -115,7 +115,7 @@ class BuilderTests {
|
||||
.withBuilderRegistryTokenAuthentication("builder token")
|
||||
.withPublishRegistryTokenAuthentication("publish token");
|
||||
given(docker.image()
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(),
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(),
|
||||
eq(dockerConfiguration.getBuilderRegistryAuthentication().getAuthHeader())))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image()
|
||||
@@ -129,7 +129,7 @@ class BuilderTests {
|
||||
assertThat(out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
ArgumentCaptor<ImageArchive> archive = ArgumentCaptor.forClass(ImageArchive.class);
|
||||
then(docker.image()).should()
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(),
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(),
|
||||
eq(dockerConfiguration.getBuilderRegistryAuthentication().getAuthHeader()));
|
||||
then(docker.image()).should()
|
||||
.pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(),
|
||||
@@ -168,7 +168,7 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image-with-run-image-digest.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image()
|
||||
.pull(eq(ImageReference
|
||||
@@ -211,7 +211,7 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("example.com/custom/run:latest")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
@@ -231,11 +231,11 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
given(docker.image().inspect(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME))))
|
||||
given(docker.image().inspect(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF))))
|
||||
.willReturn(builderImage);
|
||||
given(docker.image().inspect(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb"))))
|
||||
.willReturn(runImage);
|
||||
@@ -257,11 +257,11 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
given(docker.image().inspect(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME))))
|
||||
given(docker.image().inspect(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF))))
|
||||
.willReturn(builderImage);
|
||||
given(docker.image().inspect(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb"))))
|
||||
.willReturn(runImage);
|
||||
@@ -283,11 +283,11 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
given(docker.image().inspect(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME))))
|
||||
given(docker.image().inspect(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF))))
|
||||
.willThrow(
|
||||
new DockerEngineException("docker://localhost/", new URI("example"), 404, "NOT FOUND", null, null))
|
||||
.willReturn(builderImage);
|
||||
@@ -313,7 +313,7 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
@@ -339,7 +339,7 @@ class BuilderTests {
|
||||
.withBuilderRegistryTokenAuthentication("builder token")
|
||||
.withPublishRegistryTokenAuthentication("publish token");
|
||||
given(docker.image()
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(),
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(),
|
||||
eq(dockerConfiguration.getBuilderRegistryAuthentication().getAuthHeader())))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image()
|
||||
@@ -354,7 +354,7 @@ class BuilderTests {
|
||||
assertThat(out.toString()).contains("Successfully created image tag 'docker.io/library/my-application:1.2.3'");
|
||||
|
||||
then(docker.image()).should()
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(),
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(),
|
||||
eq(dockerConfiguration.getBuilderRegistryAuthentication().getAuthHeader()));
|
||||
then(docker.image()).should()
|
||||
.pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(),
|
||||
@@ -378,7 +378,7 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image-with-bad-stack.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
@@ -395,7 +395,7 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApiLifecycleError();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
@@ -413,7 +413,7 @@ class BuilderTests {
|
||||
DockerConfiguration dockerConfiguration = new DockerConfiguration()
|
||||
.withBuilderRegistryTokenAuthentication("builder token");
|
||||
given(docker.image()
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(),
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(),
|
||||
eq(dockerConfiguration.getBuilderRegistryAuthentication().getAuthHeader())))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
Builder builder = new Builder(BuildLog.to(out), docker, dockerConfiguration);
|
||||
@@ -431,7 +431,7 @@ class BuilderTests {
|
||||
DockerConfiguration dockerConfiguration = new DockerConfiguration()
|
||||
.withBuilderRegistryTokenAuthentication("builder token");
|
||||
given(docker.image()
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(),
|
||||
.pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(),
|
||||
eq(dockerConfiguration.getBuilderRegistryAuthentication().getAuthHeader())))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
Builder builder = new Builder(BuildLog.to(out), docker, dockerConfiguration);
|
||||
@@ -447,7 +447,7 @@ class BuilderTests {
|
||||
DockerApi docker = mockDockerApiLifecycleError();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any(), isNull()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_REF)), any(), isNull()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any(), isNull()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
@@ -490,7 +490,7 @@ class BuilderTests {
|
||||
private BuildRequest getTestRequest() {
|
||||
TarArchive content = mock(TarArchive.class);
|
||||
ImageReference name = ImageReference.of("my-application");
|
||||
return BuildRequest.of(name, (owner) -> content);
|
||||
return BuildRequest.of(name, (owner) -> content).withTrustBuilder(true);
|
||||
}
|
||||
|
||||
private Image loadImage(String name) throws IOException {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,6 +34,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.skyscreamer.jsonassert.JSONAssert;
|
||||
|
||||
@@ -53,6 +54,7 @@ import org.springframework.boot.buildpack.platform.docker.type.VolumeName;
|
||||
import org.springframework.boot.buildpack.platform.io.IOConsumer;
|
||||
import org.springframework.boot.buildpack.platform.io.TarArchive;
|
||||
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
|
||||
import org.springframework.boot.testsupport.junit.BooleanValueSource;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -87,13 +89,23 @@ class LifecycleTests {
|
||||
this.docker = mockDockerApi();
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeExecutesPhases() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeExecutesPhases(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
createLifecycle().execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator.json"));
|
||||
createLifecycle(trustBuilder).execute();
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter.json"));
|
||||
}
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@@ -102,7 +114,7 @@ class LifecycleTests {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withBindings(Binding.of("/host/src/path:/container/dest/path:ro"),
|
||||
BuildRequest request = getTestRequest(true).withBindings(Binding.of("/host/src/path:/container/dest/path:ro"),
|
||||
Binding.of("volume-name:/container/volume/path:rw"));
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-bindings.json"));
|
||||
@@ -114,48 +126,62 @@ class LifecycleTests {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
createLifecycle("builder-metadata-platform-api-0.3.json").execute();
|
||||
createLifecycle(true, "builder-metadata-platform-api-0.3.json").execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-platform-api-0.3.json"));
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeOnlyUploadsContentOnce() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeOnlyUploadsContentOnce(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
createLifecycle().execute();
|
||||
createLifecycle(trustBuilder).execute();
|
||||
assertThat(this.content).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWhenAlreadyRunThrowsException() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWhenAlreadyRunThrowsException(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
Lifecycle lifecycle = createLifecycle();
|
||||
Lifecycle lifecycle = createLifecycle(trustBuilder);
|
||||
lifecycle.execute();
|
||||
assertThatIllegalStateException().isThrownBy(lifecycle::execute)
|
||||
.withMessage("Lifecycle has already been executed");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWhenBuilderReturnsErrorThrowsException() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWhenBuilderReturnsErrorThrowsException(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(9, null));
|
||||
assertThatExceptionOfType(BuilderException.class).isThrownBy(() -> createLifecycle().execute())
|
||||
.withMessage("Builder lifecycle 'creator' failed with status code 9");
|
||||
assertThatExceptionOfType(BuilderException.class).isThrownBy(() -> createLifecycle(trustBuilder).execute())
|
||||
.withMessage(
|
||||
"Builder lifecycle '" + ((trustBuilder) ? "creator" : "analyzer") + "' failed with status code 9");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWhenCleanCacheClearsCache() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWhenCleanCacheClearsCache(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withCleanCache(true);
|
||||
BuildRequest request = getTestRequest(trustBuilder).withCleanCache(true);
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-clean-cache.json"));
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-clean-cache.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter.json"));
|
||||
assertThat(this.out.toString()).contains("Skipping restorer because 'cleanCache' is enabled");
|
||||
}
|
||||
VolumeName name = VolumeName.of("pack-cache-b35197ac41ea.build");
|
||||
then(this.docker.volume()).should().delete(name, true);
|
||||
}
|
||||
@@ -166,7 +192,7 @@ class LifecycleTests {
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(() -> createLifecycle("builder-metadata-unsupported-api.json").execute())
|
||||
.isThrownBy(() -> createLifecycle(true, "builder-metadata-unsupported-api.json").execute())
|
||||
.withMessageContaining("Detected platform API versions '0.2' are not included in supported versions");
|
||||
}
|
||||
|
||||
@@ -176,22 +202,32 @@ class LifecycleTests {
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(() -> createLifecycle("builder-metadata-unsupported-apis.json").execute())
|
||||
.isThrownBy(() -> createLifecycle(true, "builder-metadata-unsupported-apis.json").execute())
|
||||
.withMessageContaining("Detected platform API versions '0.1,0.2' are not included in supported versions");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWhenMultiplePlatformApisSupportedExecutesPhase() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWhenMultiplePlatformApisSupportedExecutesPhase(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
createLifecycle("builder-metadata-supported-apis.json").execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator.json"));
|
||||
createLifecycle(trustBuilder, "builder-metadata-supported-apis.json").execute();
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter.json"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void closeClearsVolumes() throws Exception {
|
||||
createLifecycle().close();
|
||||
createLifecycle(true).close();
|
||||
then(this.docker.volume()).should().delete(VolumeName.of("pack-layers-aaaaaaaaaa"), true);
|
||||
then(this.docker.volume()).should().delete(VolumeName.of("pack-app-aaaaaaaaaa"), true);
|
||||
}
|
||||
@@ -201,92 +237,163 @@ class LifecycleTests {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withNetwork("test");
|
||||
BuildRequest request = getTestRequest(true).withNetwork("test");
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-network.json"));
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWithCacheVolumeNamesExecutesPhases() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWithCacheVolumeNamesExecutesPhases(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withBuildWorkspace(Cache.volume("work-volume"))
|
||||
BuildRequest request = getTestRequest(trustBuilder).withBuildWorkspace(Cache.volume("work-volume"))
|
||||
.withBuildCache(Cache.volume("build-volume"))
|
||||
.withLaunchCache(Cache.volume("launch-volume"));
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-cache-volumes.json"));
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-cache-volumes.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer-cache-volumes.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector-cache-volumes.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer-cache-volumes.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder-cache-volumes.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter-cache-volumes.json"));
|
||||
}
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWithCacheBindMountsExecutesPhases() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWithCacheBindMountsExecutesPhases(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withBuildWorkspace(Cache.bind("/tmp/work"))
|
||||
BuildRequest request = getTestRequest(trustBuilder).withBuildWorkspace(Cache.bind("/tmp/work"))
|
||||
.withBuildCache(Cache.bind("/tmp/build-cache"))
|
||||
.withLaunchCache(Cache.bind("/tmp/launch-cache"));
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-cache-bind-mounts.json"));
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-cache-bind-mounts.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer-cache-bind-mounts.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector-cache-bind-mounts.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer-cache-bind-mounts.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder-cache-bind-mounts.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter-cache-bind-mounts.json"));
|
||||
}
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWithCreatedDateExecutesPhases() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWithCreatedDateExecutesPhases(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withCreatedDate("2020-07-01T12:34:56Z");
|
||||
BuildRequest request = getTestRequest(trustBuilder).withCreatedDate("2020-07-01T12:34:56Z");
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-created-date.json"));
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-created-date.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter-created-date.json"));
|
||||
}
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWithApplicationDirectoryExecutesPhases() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWithApplicationDirectoryExecutesPhases(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withApplicationDirectory("/application");
|
||||
BuildRequest request = getTestRequest(trustBuilder).withApplicationDirectory("/application");
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-app-dir.json"));
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-app-dir.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector-app-dir.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder-app-dir.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter-app-dir.json"));
|
||||
}
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWithSecurityOptionsExecutesPhases() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWithSecurityOptionsExecutesPhases(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withSecurityOptions(List.of("label=user:USER", "label=role:ROLE"));
|
||||
BuildRequest request = getTestRequest(trustBuilder)
|
||||
.withSecurityOptions(List.of("label=user:USER", "label=role:ROLE"));
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-security-opts.json", true));
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-security-opts.json", true));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer-security-opts.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer-security-opts.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter-security-opts.json"));
|
||||
}
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWithDockerHostAndRemoteAddressExecutesPhases() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWithDockerHostAndRemoteAddressExecutesPhases(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest();
|
||||
BuildRequest request = getTestRequest(trustBuilder);
|
||||
createLifecycle(request, ResolvedDockerHost.from(DockerHostConfiguration.forAddress("tcp://192.168.1.2:2376")))
|
||||
.execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-inherit-remote.json"));
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-inherit-remote.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer-inherit-remote.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer-inherit-remote.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter-inherit-remote.json"));
|
||||
}
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeWithDockerHostAndLocalAddressExecutesPhases() throws Exception {
|
||||
@ParameterizedTest
|
||||
@BooleanValueSource
|
||||
void executeWithDockerHostAndLocalAddressExecutesPhases(boolean trustBuilder) throws Exception {
|
||||
given(this.docker.container().create(any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
|
||||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest();
|
||||
BuildRequest request = getTestRequest(trustBuilder);
|
||||
createLifecycle(request, ResolvedDockerHost.from(DockerHostConfiguration.forAddress("/var/alt.sock")))
|
||||
.execute();
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-inherit-local.json"));
|
||||
if (trustBuilder) {
|
||||
assertPhaseWasRun("creator", withExpectedConfig("lifecycle-creator-inherit-local.json"));
|
||||
}
|
||||
else {
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer-inherit-local.json"));
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector.json"));
|
||||
assertPhaseWasRun("restorer", withExpectedConfig("lifecycle-restorer-inherit-local.json"));
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter-inherit-local.json"));
|
||||
}
|
||||
assertThat(this.out.toString()).contains("Successfully built image 'docker.io/library/my-application:latest'");
|
||||
}
|
||||
|
||||
@@ -301,14 +408,16 @@ class LifecycleTests {
|
||||
return docker;
|
||||
}
|
||||
|
||||
private BuildRequest getTestRequest() {
|
||||
private BuildRequest getTestRequest(boolean trustBuilder) {
|
||||
TarArchive content = mock(TarArchive.class);
|
||||
ImageReference name = ImageReference.of("my-application");
|
||||
return BuildRequest.of(name, (owner) -> content).withRunImage(ImageReference.of("cloudfoundry/run"));
|
||||
return BuildRequest.of(name, (owner) -> content)
|
||||
.withRunImage(ImageReference.of("cloudfoundry/run"))
|
||||
.withTrustBuilder(trustBuilder);
|
||||
}
|
||||
|
||||
private Lifecycle createLifecycle() throws IOException {
|
||||
return createLifecycle(getTestRequest());
|
||||
private Lifecycle createLifecycle(boolean trustBuilder) throws IOException {
|
||||
return createLifecycle(getTestRequest(trustBuilder));
|
||||
}
|
||||
|
||||
private Lifecycle createLifecycle(BuildRequest request) throws IOException {
|
||||
@@ -316,9 +425,9 @@ class LifecycleTests {
|
||||
return createLifecycle(request, builder);
|
||||
}
|
||||
|
||||
private Lifecycle createLifecycle(String builderMetadata) throws IOException {
|
||||
private Lifecycle createLifecycle(boolean trustBuilder, String builderMetadata) throws IOException {
|
||||
EphemeralBuilder builder = mockEphemeralBuilder(builderMetadata);
|
||||
return createLifecycle(getTestRequest(), builder);
|
||||
return createLifecycle(getTestRequest(trustBuilder), builder);
|
||||
}
|
||||
|
||||
private Lifecycle createLifecycle(BuildRequest request, ResolvedDockerHost dockerHost) throws IOException {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,7 +66,7 @@ class PhaseTests {
|
||||
Update update = mock(Update.class);
|
||||
phase.apply(update);
|
||||
then(update).should().withUser("root");
|
||||
then(update).should().withCommand("/cnb/lifecycle/test", NO_ARGS);
|
||||
then(update).should().withCommand("/cnb/lifecycle/test", "-daemon");
|
||||
then(update).should().withLabel("author", "spring-boot");
|
||||
then(update).shouldHaveNoMoreInteractions();
|
||||
}
|
||||
@@ -74,7 +74,6 @@ class PhaseTests {
|
||||
@Test
|
||||
void applyWhenWithLogLevelArgAndVerboseLoggingUpdatesConfigurationWithLogLevel() {
|
||||
Phase phase = new Phase("test", true);
|
||||
phase.withLogLevelArg();
|
||||
Update update = mock(Update.class);
|
||||
phase.apply(update);
|
||||
then(update).should().withCommand("/cnb/lifecycle/test", "-log-level", "debug");
|
||||
@@ -85,7 +84,6 @@ class PhaseTests {
|
||||
@Test
|
||||
void applyWhenWithLogLevelArgAndNonVerboseLoggingDoesNotUpdateLogLevel() {
|
||||
Phase phase = new Phase("test", false);
|
||||
phase.withLogLevelArg();
|
||||
Update update = mock(Update.class);
|
||||
phase.apply(update);
|
||||
then(update).should().withCommand("/cnb/lifecycle/test");
|
||||
@@ -133,7 +131,7 @@ class PhaseTests {
|
||||
|
||||
@Test
|
||||
void applyWhenWithNetworkModeUpdatesConfigurationWithNetworkMode() {
|
||||
Phase phase = new Phase("test", true);
|
||||
Phase phase = new Phase("test", false);
|
||||
phase.withNetworkMode("test");
|
||||
Update update = mock(Update.class);
|
||||
phase.apply(update);
|
||||
@@ -145,7 +143,7 @@ class PhaseTests {
|
||||
|
||||
@Test
|
||||
void applyWhenWithSecurityOptionsUpdatesConfigurationWithSecurityOptions() {
|
||||
Phase phase = new Phase("test", true);
|
||||
Phase phase = new Phase("test", false);
|
||||
phase.withSecurityOption("option1=value1");
|
||||
phase.withSecurityOption("option2=value2");
|
||||
Update update = mock(Update.class);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/analyzer",
|
||||
"-daemon",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-run-image",
|
||||
"docker.io/cloudfoundry/run:latest",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"/tmp/launch-cache:/launch-cache",
|
||||
"/tmp/work-layers:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/analyzer",
|
||||
"-daemon",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-run-image",
|
||||
"docker.io/cloudfoundry/run:latest",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"launch-volume:/launch-cache",
|
||||
"work-volume-layers:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/analyzer",
|
||||
"-daemon",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-run-image",
|
||||
"docker.io/cloudfoundry/run:latest",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/alt.sock:/var/run/docker.sock",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/analyzer",
|
||||
"-daemon",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-run-image",
|
||||
"docker.io/cloudfoundry/run:latest",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"DOCKER_HOST=tcp://192.168.1.2:2376",
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/analyzer",
|
||||
"-daemon",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-run-image",
|
||||
"docker.io/cloudfoundry/run:latest",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=user:USER",
|
||||
"label=role:ROLE"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/analyzer",
|
||||
"-daemon",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-run-image",
|
||||
"docker.io/cloudfoundry/run:latest",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/builder",
|
||||
"-app",
|
||||
"/application",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-platform",
|
||||
"/platform"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"pack-app-aaaaaaaaaa:/application",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/builder",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-platform",
|
||||
"/platform"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/tmp/work-app:/workspace",
|
||||
"/tmp/work-layers:/layers"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/builder",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-platform",
|
||||
"/platform"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"work-volume-app:/workspace",
|
||||
"work-volume-layers:/layers"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/builder",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-platform",
|
||||
"/platform"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/application",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache"
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"/host/src/path:/container/dest/path:ro",
|
||||
"volume-name:/container/volume/path:rw"
|
||||
],
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"/tmp/work-layers:/layers",
|
||||
"/tmp/work-app:/workspace",
|
||||
"/tmp/work-layers:/layers",
|
||||
"/tmp/build-cache:/cache",
|
||||
"/tmp/launch-cache:/launch-cache"
|
||||
"/tmp/launch-cache:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"work-volume-layers:/layers",
|
||||
"work-volume-app:/workspace",
|
||||
"work-volume-layers:/layers",
|
||||
"build-volume:/cache",
|
||||
"launch-volume:/launch-cache"
|
||||
"launch-volume:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache"
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache"
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/alt.sock:/var/run/docker.sock",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache"
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/alt.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache"
|
||||
],
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
"HostConfig": {
|
||||
"NetworkMode": "test",
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache"
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
|
||||
@@ -7,7 +7,13 @@
|
||||
"author" : "spring-boot"
|
||||
},
|
||||
"HostConfig" : {
|
||||
"Binds" : [ "/var/run/docker.sock:/var/run/docker.sock", "pack-layers-aaaaaaaaaa:/layers", "pack-app-aaaaaaaaaa:/workspace", "pack-cache-b35197ac41ea.build:/cache", "pack-cache-b35197ac41ea.launch:/launch-cache" ],
|
||||
"Binds" : [
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache"
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=user:USER",
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache"
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/detector",
|
||||
"-app",
|
||||
"/application",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-platform",
|
||||
"/platform"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"pack-app-aaaaaaaaaa:/application",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/detector",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-platform",
|
||||
"/platform"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/tmp/work-app:/workspace",
|
||||
"/tmp/work-layers:/layers"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/detector",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-platform",
|
||||
"/platform"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"work-volume-app:/workspace",
|
||||
"work-volume-layers:/layers"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/detector",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"-platform",
|
||||
"/platform"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/exporter",
|
||||
"-daemon",
|
||||
"-app",
|
||||
"/application",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-app-aaaaaaaaaa:/application",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/exporter",
|
||||
"-daemon",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"/tmp/work-app:/workspace",
|
||||
"/tmp/build-cache:/cache",
|
||||
"/tmp/launch-cache:/launch-cache",
|
||||
"/tmp/work-layers:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/exporter",
|
||||
"-daemon",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"work-volume-app:/workspace",
|
||||
"build-volume:/cache",
|
||||
"launch-volume:/launch-cache",
|
||||
"work-volume-layers:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/exporter",
|
||||
"-daemon",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8",
|
||||
"SOURCE_DATE_EPOCH=1593606896"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/exporter",
|
||||
"-daemon",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/alt.sock:/var/run/docker.sock",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/exporter",
|
||||
"-daemon",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"DOCKER_HOST=tcp://192.168.1.2:2376",
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/exporter",
|
||||
"-daemon",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=user:USER",
|
||||
"label=role:ROLE"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/exporter",
|
||||
"-daemon",
|
||||
"-app",
|
||||
"/workspace",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-launch-cache",
|
||||
"/launch-cache",
|
||||
"-layers",
|
||||
"/layers",
|
||||
"docker.io/library/my-application:latest"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-app-aaaaaaaaaa:/workspace",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-cache-b35197ac41ea.launch:/launch-cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/restorer",
|
||||
"-daemon",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-layers",
|
||||
"/layers"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"/tmp/build-cache:/cache",
|
||||
"/tmp/work-layers:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/restorer",
|
||||
"-daemon",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-layers",
|
||||
"/layers"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"build-volume:/cache",
|
||||
"work-volume-layers:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/restorer",
|
||||
"-daemon",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-layers",
|
||||
"/layers"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/alt.sock:/var/run/docker.sock",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/restorer",
|
||||
"-daemon",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-layers",
|
||||
"/layers"
|
||||
],
|
||||
"Env": [
|
||||
"DOCKER_HOST=tcp://192.168.1.2:2376",
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/restorer",
|
||||
"-daemon",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-layers",
|
||||
"/layers"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=user:USER",
|
||||
"label=role:ROLE"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"User": "root",
|
||||
"Image": "pack.local/ephemeral-builder",
|
||||
"Cmd": [
|
||||
"/cnb/lifecycle/restorer",
|
||||
"-daemon",
|
||||
"-cache-dir",
|
||||
"/cache",
|
||||
"-layers",
|
||||
"/layers"
|
||||
],
|
||||
"Env": [
|
||||
"CNB_PLATFORM_API=0.8"
|
||||
],
|
||||
"Labels": {
|
||||
"author": "spring-boot"
|
||||
},
|
||||
"HostConfig": {
|
||||
"Binds": [
|
||||
"/var/run/docker.sock:/var/run/docker.sock",
|
||||
"pack-cache-b35197ac41ea.build:/cache",
|
||||
"pack-layers-aaaaaaaaaa:/layers"
|
||||
],
|
||||
"SecurityOpt" : [
|
||||
"label=disable"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user