Skip to content

rmsantana/jib-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jib-Demo

build status

This project is a demonstration of how your Gitlab-CI can push your docker images to Gitlab Registry using Google Jib and Maven.

The POM file

To push the images to the Gitlab Registry, we need to authenticate on the registry, so we pass the data inside the element <auth>, passing the <username> as gitlab-ci-token and the <password> as the token retrive from the CI job.

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
		<plugin>
			<groupId>com.google.cloud.tools</groupId>
			<artifactId>jib-maven-plugin</artifactId>
			<version>1.1.2</version>
			<configuration>
				<to>
					<image>${env.CI_REGISTRY}/${env.CI_PROJECT_PATH}</image>
					<auth>
						<username>gitlab-ci-token</username>
						<password>${env.CI_JOB_TOKEN}</password>
					</auth>
				</to>
			</configuration>
		</plugin>
	</plugins>
</build>

It's possible to also add multiple tags to the image. The element <to> has a element <tags>, wich is a list of <tag>, so you can have as many tags as you like, the way you like.

<to>
    ...
    <tags>
    	<tag>${project.version}</tag>
    	<tag>latest</tag>
    </tags>
    ...
</to>

Releases

No releases published

Packages

No packages published

Languages