Jig Google

Automatiza las aplicaciones Java

Guia:

https://jaxenter.com/jib-java-containerization-146647.html

Agregar

 <build>
        <finalName>${project.artifactId}</finalName> 
        <plugins>
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>0.9.0</version>
                <configuration>
                    <to>
                        <image>mycompany/${project.artifactId}:${project.version}</image>
                    </to>
                </configuration>
            </plugin>
        </plugins>
    </build>

Arrancar docker

Construir la imagen

mvn compile jib:build

Construir el demonio en docker

mvn compile jib:dockerBuild

Archivo pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>mydoc</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>jfree</groupId>
            <artifactId>jcommon</artifactId>
            <version>1.0.15</version>
        </dependency>
    </dependencies> 
    <build>
        <finalName>${project.artifactId}</finalName> 
        <plugins>
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>0.9.0</version>
                <configuration>
                    <to>
                        <image>mycompany/${project.artifactId}:${project.version}</image>
                    </to>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>

Last updated