Skip to content

Commit

Permalink
Fix JIB integration www folder issue (#8864)
Browse files Browse the repository at this point in the history
* Fix Jib www for Maven

* Fix Jib Doc for Maven

* Fix Jib www for Gradle

* Use variable + guard
  • Loading branch information
danielpetisme authored and atomfrede committed Nov 25, 2018
1 parent cb48f25 commit 9875384
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = webpackMerge(commonConfig({ env: ENV }), {
main: './<%= MAIN_SRC_DIR %>app/app.main'
},
output: {
path: utils.root('<%= BUILD_DIR %><% if (buildTool === 'maven') { %>classes/public<% } %><% if (buildTool === 'gradle'){ %>resources/main/public<% } %>'),
path: utils.root('<%= BUILD_DIR %>www'),
filename: 'app/[name].[hash].bundle.js',
chunkFilename: 'app/[id].[hash].chunk.js'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = webpackMerge(commonConfig({ env: ENV }), {
main: './<%= MAIN_SRC_DIR %>app/index'
},
output: {
path: utils.root('<%= BUILD_DIR %><% if (buildTool === 'maven') { %>classes/public<% } %><% if (buildTool === 'gradle'){ %>resources/main/public<% } %>'),
path: utils.root('<%= BUILD_DIR %>www'),
filename: 'app/[name].[hash].bundle.js',
chunkFilename: 'app/[name].[hash].chunk.js'
},
Expand Down
2 changes: 1 addition & 1 deletion generators/common/templates/README.md.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ To stop it and remove the container, run:
You can also fully dockerize your application and all the services that it depends on.
To achieve this, first build a docker image of your app by running:
<% if (buildTool === 'maven') { %>./mvnw package -Pprod jib:dockerBuild<% } %><% if (buildTool === 'gradle') { %>./gradlew bootWar -Pprod jibDockerBuild<% } %>
<% if (buildTool === 'maven') { %>./mvnw package -Pprod verify jib:dockerBuild<% } %><% if (buildTool === 'gradle') { %>./gradlew bootWar -Pprod jibDockerBuild<% } %>
Then run:
Expand Down
2 changes: 1 addition & 1 deletion generators/docker-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function checkImages() {
const appConfig = this.appConfigs[index];
if (appConfig.buildTool === 'maven') {
imagePath = this.destinationPath(`${this.directoryPath + appsFolder}/target/jib-cache`);
runCommand = './mvnw package -Pprod jib:dockerBuild';
runCommand = './mvnw package -Pprod verify jib:dockerBuild';
} else {
imagePath = this.destinationPath(`${this.directoryPath + appsFolder}/build/jib-cache`);
runCommand = './gradlew bootWar -Pprod jibDockerBuild';
Expand Down
2 changes: 1 addition & 1 deletion generators/docker-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function checkImageExist(opts = { cwd: './', appConfig: null }) {
this.warningMessage = 'To generate the missing Docker image(s), please run:\n';
if (opts.appConfig.buildTool === 'maven') {
imagePath = this.destinationPath(`${opts.cwd + opts.cwd}/target/docker`);
this.dockerBuildCommand = './mvnw package -Pprod jib:dockerBuild';
this.dockerBuildCommand = './mvnw package -Pprod verify jib:dockerBuild';
} else {
imagePath = this.destinationPath(`${opts.cwd + opts.cwd}/build/docker`);
this.dockerBuildCommand = './gradlew bootWar -Pprod jibDockerBuild';
Expand Down
9 changes: 9 additions & 0 deletions generators/server/templates/gradle/docker.gradle.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,12 @@ jib {
useCurrentTimestamp = true
}
}

<%_ if (!skipClient) { _%>
task copyWwwIntoStatic (type: Copy) {
from '<%= CLIENT_DIST_DIR %>'
into 'build/resources/main/static'
}
jibDockerBuild.dependsOn copyWwwIntoStatic
<%_ } _%>
2 changes: 1 addition & 1 deletion generators/server/templates/pom.xml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@
</configuration>
</execution>
<execution>
<id>docker-resources</id>
<id>jib-www-resources</id>
<phase>verify</phase>
<goals>
<goal>copy-resources</goal>
Expand Down

0 comments on commit 9875384

Please sign in to comment.