Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support docker copy of resources #92

Merged
merged 4 commits into from
Jan 5, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/main/java/com/alexecollins/docker/mojo/AbstractDockerMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ abstract class AbstractDockerMojo extends AbstractMojo {
@Parameter(property = "docker.cfgPath")
private String cfgPath;

/**
* Resource to copy out of the docker container.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are not needed for other mojos and could be moved into CopyMojo? Otherwise the help for the other mojos will be confusing.

*/
@Parameter(property = "docker.resource")
private String resource;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be called source?


/**
* Resource to copy out of the docker container.
*/
@Parameter(property = "docker.targetPath")
private String targetPath;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be called dest?


/**
* Clean container only in clean.
*/
Expand Down Expand Up @@ -288,4 +300,12 @@ private File src() {
public boolean isCleanContainerOnly() {
return cleanContainerOnly;
}

public String getResource() {
return resource;
}

public String getTargetPath() {
return targetPath;
}
}
18 changes: 18 additions & 0 deletions src/main/java/com/alexecollins/docker/mojo/CopyMojo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.alexecollins.docker.mojo;

import com.alexecollins.docker.orchestration.DockerOrchestrator;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;

/**
* Copy resources from the containers.
*/
@Mojo(name = "copy", defaultPhase = LifecyclePhase.PACKAGE)
public class CopyMojo extends AbstractDockerMojo {

@Override
protected void doExecute(DockerOrchestrator orchestrator) throws Exception {
getLog().info("Copying " + getResource() + " to " + getTargetPath());
orchestrator.copy(getResource(), getTargetPath());
}
}