diff --git a/generators/app/__snapshots__/generator.spec.ts.snap b/generators/app/__snapshots__/generator.spec.ts.snap index ef92705179d0..c311f5f7d5bc 100644 --- a/generators/app/__snapshots__/generator.spec.ts.snap +++ b/generators/app/__snapshots__/generator.spec.ts.snap @@ -456,7 +456,6 @@ exports[`generator - app with default config should match snapshot 1`] = ` "zipkinTag": "zipkin-tag-placeholder", }, "dockerServices": [ - "app", "postgresql", ], "dockerServicesDir": "src/main/docker/", @@ -1129,7 +1128,6 @@ exports[`generator - app with gateway should match snapshot 1`] = ` "zipkinTag": "zipkin-tag-placeholder", }, "dockerServices": [ - "app", "consul", "zipkin", "postgresql", @@ -1796,7 +1794,6 @@ exports[`generator - app with microservice should match snapshot 1`] = ` "zipkinTag": "zipkin-tag-placeholder", }, "dockerServices": [ - "app", "consul", "zipkin", "hazelcast", diff --git a/generators/docker/files.ts b/generators/docker/files.ts index 3abff2b75785..878fc1282253 100644 --- a/generators/docker/files.ts +++ b/generators/docker/files.ts @@ -123,7 +123,7 @@ export const dockerFiles = { applicationFiles: [ { path: TEMPLATES_DOCKER_DIR, - condition: ctx => ctx.dockerServices.includes('app'), + condition: ctx => ctx.dockerServices.includes('app') || ctx.backendTypeSpringBoot, renameTo, templates: ['app.yml'], }, diff --git a/generators/docker/generator.ts b/generators/docker/generator.ts index 2a0628c49210..e7551c01c376 100644 --- a/generators/docker/generator.ts +++ b/generators/docker/generator.ts @@ -57,9 +57,6 @@ export default class DockerGenerator extends BaseApplicationGenerator { return this.asPreparingTaskGroup({ dockerServices({ application }) { const dockerServices = application.dockerServices!; - if (application.backendTypeSpringBoot) { - dockerServices.push('app'); - } if (application.authenticationTypeOauth2) { dockerServices.push('keycloak'); } diff --git a/generators/spring-boot/generator.ts b/generators/spring-boot/generator.ts index e92463652b54..b0b734c2235c 100644 --- a/generators/spring-boot/generator.ts +++ b/generators/spring-boot/generator.ts @@ -593,6 +593,8 @@ public void set${javaBeanCase(propertyName)}(${propertyType} ${propertyName}) { addSpringBootCompose({ application, source }) { if (!application.dockerServices?.length) return; + source.addLogbackMainLog!({ name: 'org.springframework.boot.docker', level: 'WARN' }); + const dockerComposeArtifact = { groupId: 'org.springframework.boot', artifactId: 'spring-boot-docker-compose' }; if (application.buildToolGradle) { source.addGradleDependency!({ ...dockerComposeArtifact, scope: 'developmentOnly' }); diff --git a/generators/spring-boot/templates/src/main/resources/config/application-dev.yml.ejs b/generators/spring-boot/templates/src/main/resources/config/application-dev.yml.ejs index 93e2b3ef8026..810deb33b703 100644 --- a/generators/spring-boot/templates/src/main/resources/config/application-dev.yml.ejs +++ b/generators/spring-boot/templates/src/main/resources/config/application-dev.yml.ejs @@ -87,7 +87,7 @@ spring: additional-exclude: static/**<% if (devDatabaseTypeH2Any) { %>,.h2.server.properties<% } %> livereload: enabled: false # we use Webpack dev server + BrowserSync for livereload -<%_ if (devDatabaseTypeH2Any && 'dockerServices' in locals && dockerServices && dockerServices.length > 1) { _%> +<%_ if (devDatabaseTypeH2Any && 'dockerServices' in locals && dockerServices?.length) { _%> docker: compose: enabled: <%- authenticationTypeOauth2 || messageBrokerAny || serviceDiscoveryAny || cacheProviderRedis %> diff --git a/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs b/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs index 00382797c53a..b8f34be8d34a 100644 --- a/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs +++ b/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs @@ -269,7 +269,7 @@ spring: group: <%= dasherizedBaseName %> <%_ } _%> <%_ } _%> -<%_ if ('dockerServices' in locals && dockerServices && dockerServices.length > 1) { _%> +<%_ if ('dockerServices' in locals && dockerServices?.length) { _%> docker: compose: enabled: true