Search in sources :

Example 6 with AssemblyConfiguration

use of io.fabric8.maven.docker.config.AssemblyConfiguration in project docker-maven-plugin by fabric8io.

the class DockerAssemblyManager method createBuildArchiver.

private TarArchiver createBuildArchiver(File outputDir, File archive, AssemblyConfiguration assemblyConfig) throws NoSuchArchiverException {
    TarArchiver archiver = (TarArchiver) archiverManager.getArchiver("tar");
    archiver.setLongfile(TarLongFileMode.posix);
    AssemblyMode mode = assemblyConfig != null ? assemblyConfig.getMode() : null;
    if (mode != null && mode.isArchive()) {
        DefaultArchivedFileSet archiveSet = DefaultArchivedFileSet.archivedFileSet(new File(outputDir, assemblyConfig.getName() + "." + mode.getExtension()));
        archiveSet.setPrefix(assemblyConfig.getName() + "/");
        archiveSet.setIncludingEmptyDirectories(true);
        archiveSet.setUsingDefaultExcludes(false);
        archiver.addArchivedFileSet(archiveSet);
    } else {
        DefaultFileSet fileSet = DefaultFileSet.fileSet(outputDir);
        fileSet.setUsingDefaultExcludes(false);
        archiver.addFileSet(fileSet);
    }
    archiver.setDestFile(archive);
    return archiver;
}
Also used : TarArchiver(org.codehaus.plexus.archiver.tar.TarArchiver) DefaultFileSet(org.codehaus.plexus.archiver.util.DefaultFileSet) DefaultArchivedFileSet(org.codehaus.plexus.archiver.util.DefaultArchivedFileSet) AssemblyMode(io.fabric8.maven.docker.config.AssemblyMode) File(java.io.File)

Example 7 with AssemblyConfiguration

use of io.fabric8.maven.docker.config.AssemblyConfiguration in project docker-maven-plugin by fabric8io.

the class DockerAssemblyConfigurationSourceTest method permissionMode.

@SuppressWarnings("deprecation")
@Test
public void permissionMode() {
    try {
        new AssemblyConfiguration.Builder().permissions("blub").build();
    } catch (IllegalArgumentException exp) {
        assertTrue(exp.getMessage().contains("blub"));
    }
    AssemblyConfiguration config = new AssemblyConfiguration.Builder().ignorePermissions(false).permissions("ignore").build();
    assertTrue(config.isIgnorePermissions());
    ;
}
Also used : AssemblyConfiguration(io.fabric8.maven.docker.config.AssemblyConfiguration) Test(org.junit.Test)

Example 8 with AssemblyConfiguration

use of io.fabric8.maven.docker.config.AssemblyConfiguration in project docker-maven-plugin by fabric8io.

the class DockerAssemblyManagerTest method testNoAssembly.

@Test
public void testNoAssembly() {
    BuildImageConfiguration buildConfig = new BuildImageConfiguration();
    AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration();
    DockerFileBuilder builder = assemblyManager.createDockerFileBuilder(buildConfig, assemblyConfig);
    String content = builder.content();
    assertFalse(content.contains("COPY"));
    assertFalse(content.contains("VOLUME"));
}
Also used : AssemblyConfiguration(io.fabric8.maven.docker.config.AssemblyConfiguration) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) Test(org.junit.Test)

Aggregations

AssemblyConfiguration (io.fabric8.maven.docker.config.AssemblyConfiguration)6 File (java.io.File)3 AssemblyMode (io.fabric8.maven.docker.config.AssemblyMode)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 Assembly (org.apache.maven.plugin.assembly.model.Assembly)2 TarArchiver (org.codehaus.plexus.archiver.tar.TarArchiver)2 DefaultFileSet (org.codehaus.plexus.archiver.util.DefaultFileSet)2 Test (org.junit.Test)2 BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 InvalidAssemblerConfigurationException (org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException)1 ArchiveCreationException (org.apache.maven.plugin.assembly.archive.ArchiveCreationException)1 AssemblyFormattingException (org.apache.maven.plugin.assembly.format.AssemblyFormattingException)1 DefaultArchivedFileSet (org.codehaus.plexus.archiver.util.DefaultArchivedFileSet)1 FixedStringSearchInterpolator (org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator)1