把 SAP UI5 应用部署到 SAP Kyma
鏈接:https://developers.sap.com/tutorials/cp-kyma-frontend-ui5-mssql.html
本地文件:C:\Code\referenceCode\SAP Kyma教程例子\frontend-ui5-mssql
dockerfile 的內(nèi)容:
# build environment FROM node:current-slim as build WORKDIR /app COPY package.json ./ RUN npm install COPY . . RUN npm run-script build# production environment FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/htmlWORKDIR /app
The WORKDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile. If the WORKDIR doesn’t exist, it will be created even if it’s not used in any subsequent Dockerfile instruction.
將接下來的 RUN, CMD, ENTRYPOINT, COPY 和 ADD 指令設(shè)置工作目錄。
可以重復使用:
WORKDIR /a WORKDIR b WORKDIR c RUN pwdThe output of the final pwd command in this Dockerfile would be /a/b/c.
COPY package.json ./
The COPY instruction copies new files or directories from and adds them to the filesystem of the container at the path .
COPY sourcr target, 注意,target 指的是容器文件系統(tǒng)內(nèi)的路徑。
target 可以是相對路徑或者絕對路徑。
相對路徑的例子:COPY test.txt relativeDir/
在執(zhí)行時,實際上是:WORKDIR/relativeDir/
絕對路徑的例子:COPY test.txt /absoluteDir/
首先執(zhí)行 npm install:
本地命令行啟動 SAP UI5:
npm run-script start
之后 localhost:8080 即可訪問:
構(gòu)建 docker 鏡像:
docker build -t i042416/fe-ui5-mssql -f docker/Dockerfile .
發(fā)現(xiàn)在 windows 上打包有點問題:
current-slim: Pulling from library/node
no matching manifest for windows/amd64 10.0.19042 in the manifest list entries
docker desktop 里,將容器類型切換成 linux container,重試。
切換之后就可以成功構(gòu)建了:
然后將該鏡像上傳到 docker hub:
docker push i042416/fe-ui5-mssql
上傳成功:
在 SAP Kyma dev namespace 上部署一個 APIRule,其作用是,將應(yīng)用暴露給 internet 訪問。
deployment 成功:
部署 configmap.yaml, 指定 SAP UI5 消費后臺服務(wù)的 url:
上傳一個 deployment,鏡像使用我之前 docker build 生成的鏡像:
部署成功:
點擊 api rule,即可得到 SAP UI5 公網(wǎng)訪問的 url 了:
https://fe-ui5-mssql.c-46d70f2.kyma.shoot.live.k8s-hana.ondemand.com/
更多Jerry的原創(chuàng)文章,盡在:“汪子熙”:
總結(jié)
以上是生活随笔為你收集整理的把 SAP UI5 应用部署到 SAP Kyma的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 刺客信条英灵殿杜兰达尔短剑在哪里 杜兰达
- 下一篇: SAP CRM One Order 框架