Skip to content

Commit

Permalink
Some smaller fixed, documentation cleanup.
Browse files Browse the repository at this point in the history
Relates to #229 and #207.
  • Loading branch information
rhuss committed Jul 23, 2015
1 parent 1aecef8 commit 934192a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 90 deletions.
76 changes: 2 additions & 74 deletions doc/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ of an image configuration. The available subelements are
which are passed to bash. The run commands are inserted right after the assembly and after **workdir** in to the
Dockerfile. This tag is not to be confused with the `<run>` section for this image which specifies the runtime
behaviour when starting containers.
* **skip** disables building of the image when the `docker:build` goal is executed. See
[Skipping Build / Run Configurations](#skiping-build-/-run-configurations) below.
* **skip** if set to true disables building of the image. This config option is best used together with a maven property
* **tags** contains a list of additional `tag` elements with which an
image is to be tagged after the build.
* **volumes** contains a list of `volume` elements to create a container
Expand Down Expand Up @@ -542,8 +541,7 @@ The `<run>` configuration knows the following sub elements:
* **restartPolicy** (*v1.15*) specifies the container restart policy, see
[below](#container-restart-policy)
* **user** (*v1.11*) user used inside the container
* **skip** disables building of the image when the `docker:build` goal is executed. See
[Skipping Build / Run Configurations](#skiping-build-/-run-configurations) below.
* **skip** disable creating and starting of the container. This option is best used together with a configuration option.
* **volumes** for bind configurtion of host directories and from other containers. See "[Volume binding]
(#volume-binding)" for details.
* **wait** specifies condition which must be fulfilled for the startup
Expand Down Expand Up @@ -1142,7 +1140,6 @@ up from the following properties, which correspond to corresponding
values in the `<build>` and `<run>` sections.

* **docker.alias** Alias name
* **docker.mode** See [Build / Run Mode](#build-run-mode) below, default is `both`
* **docker.assembly.baseDir** Directory name for the exported artifacts as
described in an assembly (which is `/maven` by default).
* **docker.assembly.descriptor** Path to the assembly descriptor when
Expand Down Expand Up @@ -1257,75 +1254,6 @@ Example:
</build>
```

### Skipping Build / Run Configurations

There may be instances where you may not wish to have a container for an image be built and/or started regardless of how
it is requested (life-cycle or direct goal invocation).

The `mode` element may be set to one of the following values:

* **both** (default): the `build` and `run` configurations for the image will be executed
* **build**: only the `build` configuration is executed
* **run**: only the `run` configuration is executed
* **skip**: the `build` and `run` configurations for the image will be skipped

One such example of this is running integration tests against a database container. If your application also runs in a container,
you may not want it to start as part of running the tests, but you still want it built.

```xml
<properties>
<application.image.mode>both</application.image.mode>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>azul/zulu-openjdk:8</name>
<alias>application</alias>
<mode>${application.image.mode}</mode>
...
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>integration-tests</id>
<properties>
<application.image.mode>build</application.image.mode>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images combine.children="append">
<image>
<name>postgres:9.3</name>
<alias>database</alias>
...
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

```



### Registry handling

Docker uses registries to store images. The registry is typically
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jolokia/docker/maven/BuildMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected void executeInternal(DockerAccess dockerAccess) throws DockerAccessExc
BuildImageConfiguration buildConfig = imageConfig.getBuildConfiguration();
if (buildConfig != null) {
if (buildConfig.skip()) {
log.info(imageConfig.getDescription() + ": Skipped, 'build' not enabled");
log.info(imageConfig.getDescription() + ": Skipped building");
} else {
buildImage(dockerAccess, imageConfig, buildConfig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ public class BuildImageConfiguration {
*/
private List<String> runCmds;

/** @parameter default-value="true" */
private Boolean cleanup;
/**
* @parameter default-value="false"
*/
private boolean cleanup = false;

/**
* @paramter
Expand Down Expand Up @@ -86,8 +88,10 @@ public class BuildImageConfiguration {
*/
private AssemblyConfiguration assembly;

/** @paramter default-falue="false" */
private Boolean skip;
/**
* @parameter
*/
private boolean skip = false;

public BuildImageConfiguration() {}

Expand Down Expand Up @@ -140,12 +144,12 @@ public String getCommand() {
return command;
}

public Boolean cleanup() {
return (cleanup == null) ? Boolean.FALSE : cleanup;
public boolean cleanup() {
return cleanup;
}

public Boolean skip() {
return (skip == null) ? Boolean.FALSE : skip;
public boolean skip() {
return skip;
}

public Arguments getEntryPoint() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.util.List;
import java.util.Map;

import org.jolokia.docker.maven.config.BuildImageConfiguration.Builder;


/**
* @author roland
Expand Down Expand Up @@ -160,8 +158,10 @@ public enum NamingStrategy {
*/
private RestartPolicy restartPolicy;

/** @paramter default-falue="false" */
private Boolean skip;
/**
* @parameter
*/
private boolean skip = false;

public RunImageConfiguration() { }

Expand Down Expand Up @@ -265,8 +265,8 @@ public RestartPolicy getRestartPolicy() {
return (restartPolicy == null) ? RestartPolicy.DEFAULT : restartPolicy;
}

public Boolean skip() {
return (skip == null) ? Boolean.FALSE : skip;
public boolean skip() {
return skip;
}

// ======================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private List<StartOrderResolver.Resolvable> convertToResolvables(List<ImageConfi
List<StartOrderResolver.Resolvable> ret = new ArrayList<>();
for (ImageConfiguration config : images) {
if (config.getRunConfiguration().skip()) {
log.info(config.getDescription() + ": Skipped, 'run' not enabled");
log.info(config.getDescription() + ": Skipped running");
} else {
ret.add(config);
}
Expand Down

0 comments on commit 934192a

Please sign in to comment.