Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO-ISSUE: Use image-builder and maven-m2-repo-via-http-image to build serverless-logic-web-tools-swf-dev-mode-image #2574

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN chown kogito /home/kogito/.m2
USER kogito

COPY --chown=kogito:root dist-dev/quarkus-app/ /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/
COPY --chown=kogito:root dist-dev/quarkus-app-m2/ /home/kogito/.m2/repository
COPY --chown=kogito:root dist-dev/settings.xml /home/kogito/.m2/settings.xml

WORKDIR /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/

Expand All @@ -35,7 +35,9 @@ RUN rm -rf src/test/ && \
quarkus:go-offline \
-B \
-ntp \
-s /home/kogito/.m2/settings.xml \
-Dmaven.test.skip \
-Dmaven.repo.local=/home/kogito/.m2/repository \
-Dquarkus-profiles=build,dev

USER root
Expand All @@ -45,6 +47,8 @@ USER kogito
ENTRYPOINT mvn quarkus:dev \
quarkus:go-offline \
-nsu \
-o \
-s /home/kogito/.m2/settings.xml \
-Ddebug=false \
-Dmaven.repo.local=/home/kogito/.m2/repository \
-Dquarkus.http.port=8080
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const { varsWithName, getOrDefault, composeEnv } = require("@kie-tools-scripts/b

const rootEnv = require("@kie-tools/root-env/env");

const {
env: { mavenM2RepoViaHttpImage: mavenM2RepoViaHttpImageEnv },
} = require("@kie-tools/maven-m2-repo-via-http-image/env");

module.exports = composeEnv([rootEnv, require("@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env/env")], {
vars: varsWithName({
/* (begin) This part of the file is referenced in `scripts/update-kogito-version` */
Expand All @@ -29,12 +33,21 @@ module.exports = composeEnv([rootEnv, require("@kie-tools/serverless-logic-web-t
description: "",
},
/* end */
SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__mavenM2RepoViaHttpImage: {
default: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.tag}`,
description: "The image tag for the Maven M2 Repo via HTTP. Used during the build only.",
},
}),
get env() {
return {
swfDevModeImage: {
version: require("../package.json").version,
kogitoImageTag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__kogitoBaseBuilderImageTag),
dev: {
mavenM2RepoViaHttpImage: getOrDefault(
this.vars.SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__mavenM2RepoViaHttpImage
),
},
},
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,29 @@
"url": "https://github.com/apache/incubator-kie-tools/issues"
},
"scripts": {
"build:dev": "echo Nothing to do",
"build:prod": "pnpm cleanup && run-script-os",
"build:prod:darwin:linux": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy:assets\" \"pnpm image:docker:build\"",
"build:prod:win32": "echo \"Build not supported on Windows\"",
"cleanup": "rimraf dist-dev && mkdir dist-dev",
"copy:assets": "pnpm copy:quarkus-app && pnpm copy:sonataflow-deployment-webapp && pnpm copy:m2-for-sonataflow-quarkus-devui",
"copy:m2-for-sonataflow-quarkus-devui": "mvn dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DexcludeTransitive=true -DoutputDirectory=./dist-dev/quarkus-app-m2",
"copy:quarkus-app": "cp -R ./node_modules/@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app/ ./dist-dev/quarkus-app && mkdir -p ./dist-dev/quarkus-app/src/main/resources/META-INF/resources/ && rm -rf ./dist-dev/quarkus-app/node_modules ./dist-dev/quarkus-app/install.js ./dist-dev/quarkus-app/env ./dist-dev/quarkus-app/package.json",
"copy:sonataflow-deployment-webapp": "cp -R ./node_modules/sonataflow-deployment-webapp/dist/* ./dist-dev/quarkus-app/src/main/resources/META-INF/resources",
"image:docker:build": "run-script-if --bool $([ $(command -v docker) ] && echo true || echo false) --then \"docker build --ulimit nofile=5000:5000 $(echo $(build-env swfDevModeImageEnv.buildTag) | xargs printf -- \"-t $(build-env swfDevModeImageEnv.registry)/$(build-env swfDevModeImageEnv.account)/$(build-env swfDevModeImageEnv.name):%s\n\" | xargs echo) --build-arg KOGITO_IMAGE_TAG=$(build-env swfDevModeImage.kogitoImageTag) .\" --else \"echo Docker not found, skipping image build.\"",
"install": "node install.js"
"build": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm m2-repo-via-http:container:run\" \"pnpm copy:assets\" \"pnpm image:docker:build\" --finally \"pnpm m2-repo-via-http:container:kill\"",
"build:dev": "pnpm build",
"build:prod": "pnpm build",
"copy:assets": "rimraf dist-dev && mkdir -p ./dist-dev && pnpm copy:quarkus-app && pnpm copy:sonataflow-deployment-webapp && pnpm copy:maven-m2-repo-via-http-image--settings-xml",
"copy:maven-m2-repo-via-http-image--settings-xml": "run-script-os",
"copy:maven-m2-repo-via-http-image--settings-xml:linux:darwin": "M2_REPO_VIA_HTTP_URL_WITHOUT_PROTOCOL=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' m2-repo-via-http) envsubst < ./node_modules/@kie-tools/maven-m2-repo-via-http-image/settings.xml.envsubst > dist-dev/settings.xml",
"copy:maven-m2-repo-via-http-image--settings-xml:win32": "pnpm powershell \"(Get-Content ./node_modules/@kie-tools/maven-m2-repo-via-http-image/settings.xml.envsubst) -replace '$M2_REPO_VIA_HTTP_URL_WITHOUT_PROTOCOL', $(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' m2-repo-via-http) | Set-Content ./dist-dev/settings.xml\"",
"copy:quarkus-app": "run-script-os",
"copy:quarkus-app:linux:darwin": "cp -R ./node_modules/@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app/ ./dist-dev/quarkus-app && mkdir -p ./dist-dev/quarkus-app/src/main/resources/META-INF/resources/ && rm -rf ./dist-dev/quarkus-app/node_modules ./dist-dev/quarkus-app/install.js ./dist-dev/quarkus-app/env ./dist-dev/quarkus-app/package.json",
"copy:quarkus-app:win32": "pnpm powershell \"New-Item -ItemType Directory -Force -Path ./dist-dev/quarkus-app; Copy-Item -R ./node_modules/@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app/* ./dist-dev/quarkus-app -Exclude @('node_modules', 'install.js', 'package.json'); New-Item -ItemType Directory -Force -Path ./dist-dev/quarkus-app/src/main/resources/META-INF/resources \"",
"copy:sonataflow-deployment-webapp": "run-script-os",
"copy:sonataflow-deployment-webapp:linux:darwin": "cp -R ./node_modules/sonataflow-deployment-webapp/dist/* ./dist-dev/quarkus-app/src/main/resources/META-INF/resources",
"copy:sonataflow-deployment-webapp:win32": "pnpm powershell \"Copy-Item -R ./node_modules/sonataflow-deployment-webapp/dist/* ./dist-dev/quarkus-app/src/main/resources/META-INF/resources\"",
"image:docker:build": "kie-tools--image-builder build --allowHostNetworkAccess -r \"$(build-env swfDevModeImageEnv.registry)\" -a \"$(build-env swfDevModeImageEnv.account)\" -n \"$(build-env swfDevModeImageEnv.name)\" -t \"$(build-env swfDevModeImageEnv.buildTag)\" --build-arg KOGITO_IMAGE_TAG=\"$(build-env swfDevModeImage.kogitoImageTag)\"",
"install": "node install.js",
"m2-repo-via-http:container:kill": "(docker container kill m2-repo-via-http || true) && (docker container rm m2-repo-via-http || true)",
"m2-repo-via-http:container:run": "(pnpm m2-repo-via-http:container:kill || true) && docker run --name m2-repo-via-http -v \"$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout):/var/www/html\" -dit $(build-env swfDevModeImage.dev.mavenM2RepoViaHttpImage)",
"powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command"
},
"devDependencies": {
"@kie-tools/image-builder": "workspace:*",
"@kie-tools/maven-config-setup-helper": "workspace:*",
"@kie-tools/maven-m2-repo-via-http-image": "workspace:*",
"@kie-tools/root-env": "workspace:*",
"@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app": "workspace:*",
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env": "workspace:*",
Expand Down
54 changes: 0 additions & 54 deletions packages/serverless-logic-web-tools-swf-dev-mode-image/pom.xml

This file was deleted.

6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions repo/graph.dot
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ digraph G {
"@kie-tools/serverless-logic-web-tools-swf-builder-image" -> "sonataflow-deployment-webapp" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-builder-image-env" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app" -> "@kie-tools/sonataflow-quarkus-devui" [ style = "solid", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/maven-m2-repo-via-http-image" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "sonataflow-deployment-webapp" [ style = "dashed", color = "black" ];
Expand Down
5 changes: 5 additions & 0 deletions repo/graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,11 @@
"target": "@kie-tools/sonataflow-quarkus-devui",
"weight": 1
},
{
"source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image",
"target": "@kie-tools/maven-m2-repo-via-http-image",
"weight": 1
},
{
"source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image",
"target": "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app",
Expand Down
Loading