Docker image oluşturur
build goal
Şöyle yaparız
mvn docker:build
push goal
Konfigurasyon
assembly ile jar kopyalanır
from ile kullanılacak image belirtilir
entryPoint tag ile container başlarken çalıştıracak komut belirtilir
Örnek
Şöyle yaparız
<configuration> <pushRegistry>localhost:5000</pushRegistry> <containerNamePattern>%n</containerNamePattern> <images> <image> <alias>maven-demo</alias> <name>my1795/docker-demo:${project.version}</name> <build> <from>openjdk:17-alpine</from> <assemblies> <assembly> <mode>dir</mode> <descriptorRef>artifact</descriptorRef> </assembly> </assemblies> <entryPoint>java -jar maven/${project.artifactId}-${project.version}.jar</entryPoint> </build> <run> <ports> <port>8080:8080</port> </ports> </run> </image> </images> </configuration>
Örnek
Şöyle yaparız
<configuration><verbose>true</verbose><dockerHost>${env.DOCKER_PORT}</dockerHost><images><image><name>${env.CI_REGISTRY_IMAGE}/${project.artifactId}</name><build><shell><exec><arg>/bin/sh</arg><arg>-c</arg><arg>mkdir -p /mnt/backend</arg></exec></shell><from>openjdk:11</from><ports><port>8084</port><port>9091</port></ports><volumes><volume>/mnt/backend</volume></volumes><entryPoint><exec><args>java</args><args>-jar</args><args>/maven/${project.artifactId}-${project.version}.jar</args></exec></entryPoint><assembly><descriptorRef>artifact</descriptorRef></assembly></build></image></images></configuration>
Hiç yorum yok:
Yorum Gönder