Skip to content

Commit

Permalink
adjusts to docker-compose integration
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Jan 23, 2025
1 parent 2933238 commit 7d29197
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions generators/app/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down Expand Up @@ -1129,7 +1128,6 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"zipkinTag": "zipkin-tag-placeholder",
},
"dockerServices": [
"app",
"consul",
"zipkin",
"postgresql",
Expand Down Expand Up @@ -1796,7 +1794,6 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"zipkinTag": "zipkin-tag-placeholder",
},
"dockerServices": [
"app",
"consul",
"zipkin",
"hazelcast",
Expand Down
2 changes: 1 addition & 1 deletion generators/docker/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
},
Expand Down
3 changes: 0 additions & 3 deletions generators/docker/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 2 additions & 0 deletions generators/spring-boot/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d29197

Please sign in to comment.