Replace command line Docker image build with Gradle Jib plugin

This commit is contained in:
Aleksandar Vidakovic
2022-01-02 14:15:34 +08:00
committed by Petri Tuomola
parent b2dbbe66de
commit 6e052e536b
9 changed files with 59 additions and 93 deletions
@@ -45,13 +45,16 @@ public class PersistenceConfig {
@Bean
@DependsOn("tenantDatabaseUpgradeService")
public EntityManagerFactory entityManagerFactory() {
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(routingDataSource);
// NOTE: very important to set this explicitly when building Docker images with Jib; otherwise complains about
// duplicate resources
em.setPersistenceXmlLocation("classpath:META-INF/persistence.xml");
em.setJpaVendorAdapter(new OpenJpaVendorAdapter());
em.setPersistenceUnitName("jpa-pu");
em.afterPropertiesSet();
return em.getObject();
return em;
}
@Bean