Skip to content

Commit

Permalink
Fix for tar creation missing dockerfile and wrong folder name
Browse files Browse the repository at this point in the history
  • Loading branch information
John Moon committed Dec 28, 2017
1 parent a038311 commit 51ceadd
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public File createDockerTarArchive(String imageName, MojoParameters params, Buil
*/
public File createDockerTarArchive(String imageName, MojoParameters params, BuildImageConfiguration buildConfig, Logger log, ArchiverCustomizer finalCustomizer)
throws MojoExecutionException {
BuildDirs buildDirs = createBuildDirs(imageName, params);
final BuildDirs buildDirs = createBuildDirs(imageName, params);

AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration();
final AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration();

// Build up assembly. In dockerfile mode this must be added explicitly in the Dockerfile with an ADD
if (hasAssemblyConfiguration(assemblyConfig)) {
Expand Down Expand Up @@ -135,6 +135,10 @@ public TarArchiver customize(TarArchiver archiver) throws IOException {
// Exclude non-interpolated dockerfile from source tree
// Interpolated Dockerfile is already added as it was created into the output directory
excludeDockerfile(fileSet, dockerFile);
AssemblyMode mode = assemblyConfig != null ? assemblyConfig.getMode() : null;
if (mode != null && mode.isArchive()) {
archiver.addFile(new File(buildDirs.getOutputDirectory(), dockerFile.getName()), dockerFile.getName());
}
archiver.addFileSet(fileSet);
return archiver;
}
Expand Down Expand Up @@ -365,7 +369,7 @@ private TarArchiver createBuildArchiver(File outputDir, File archive, AssemblyCo
if (mode != null && mode.isArchive()) {
DefaultArchivedFileSet archiveSet =
DefaultArchivedFileSet.archivedFileSet(new File(outputDir, assemblyConfig.getName() + "." + mode.getExtension()));
archiveSet.setPrefix(mode + "/");
archiveSet.setPrefix(assemblyConfig.getName() + "/");
archiveSet.setIncludingEmptyDirectories(true);
archiveSet.setUsingDefaultExcludes(false);
archiver.addArchivedFileSet(archiveSet);
Expand Down

0 comments on commit 51ceadd

Please sign in to comment.