当前位置:网站首页>Deploy a go MSSQL API endpoint on SAP kyma
Deploy a go MSSQL API endpoint on SAP kyma
2022-06-11 18:39:00 【Hua Weiyun】
link :https://developers.sap.com/tutorials/cp-kyma-api-mssql-golang.html
Local files :C:\Code\referenceCode\SAP Kyma Tutorial examples \api-mssql-go
main.go
go Access to applications :

dockerfile

The dockerfile Two phases are defined to construct docker Image file .
(1)In the first stage, a Go image is used. It copies the related content of the project into the image and builds the application.

(2)The built application is then copied into the Docker scratch image and exposed on port 8000. The scratch image is an empty image containing no other tools within it so obtaining a shell/bash session is not possible.
FROM scratchWORKDIR /appCOPY --from=builder /app/api-mssql-go /app/If the above three lines are deleted , Yes, the final built docker The impact of mirror files is , The size will be larger than the size of the image file without annotation . The purpose of these three lines of code is , From an empty scratch The mirror starts to build , Only before go Mirror image /app/api-mssql-go Copy the folder to the new image app Catalog , So the size is greatly reduced .
apirule:
You can see from the above picture that , This GO MSSQL API endpoint, Support the addition, deletion, modification and query of orders .
Run locally go application :
go run ./cmd/api/main.go
Local endpoint as follows :
Read the order :curl -i -H “Accept: application/json” -H “Content-Type: application/json” -X GET http://localhost:8000/orders
Create order :curl --data “{“order_id”:“10000003”,“description”:“test from curl”}” http://localhost:8000/orders
Get into api-mssql-go Folder , structure docker Mirror image :
docker build -t i042416/api-mssql-go -f docker/Dockerfile .
Upload the image :
docker push <your-docker-id>/api-mssql-go
Local boot mirror :
docker run -p 8000:8000 --name api-mssql-go \-e MYAPP_username="sa" \-e MYAPP_password="Yukon900" \-e MYAPP_database="DemoDB" \-e MYAPP_host="host.docker.internal" \-e MYAPP_port="1433" \-d <your-docker-id>/api-mssql-go:latestLast , hold k8s All under the folder yaml file , Deploy to SAP Kyma that will do .

边栏推荐
猜你喜欢

Non recursive traversal of binary tree

Quanzhi Technology T3 Development Board (4 Core ARM Cortex - A7) - mqtt Communication Protocol case
![[c language] compress strings and add markup characters](/img/b7/f7918f3ee0c409faffc70addd5ee65.png)
[c language] compress strings and add markup characters

北京邮电大学2023级工商管理硕士MBA(非全日制)已开启

On the problem that the while loop condition in keil does not hold but cannot jump out

Quanzhi T3 development board (4-core arm cortex-a7) - detailed explanation of logo display during system startup

基于TI AM5728 + Artix-7 FPGA开发板(DSP+ARM) 5G通信测试手册

On the sequence traversal of binary tree Ⅱ
用户信息管理的功能开发

Niu Ke's questions -- two sorting methods
随机推荐
用户信息管理的功能开发
Summary of common mysql/redis interview questions
[c language] output the students within the specified score range with the structure
[c language] compress strings and add markup characters
使用mysql判断日期是星期几
[c language] output the students with the highest scores with a structure. There can be multiple highest scores
力扣39题组合总和
牛客刷题——两种排序方法
New project construction environment method
Prevent enemy tanks from overlapping
非递归实现二叉树的前、中、后序遍历
TR-069 protocol introduction
Niu Ke's question -- Fibonacci series
论工作流选型
「案例分享」基于 AM57x+ Artix-7 FPGA开发板——PRU开发手册详解
Specific methods for JS to realize full screen display
力扣刷题——二叉树的层序遍历
Quanzhi technology T3 development board (4-core arm cortex-a7) - video development case
为何TI的GPMC并口,更常被用于连接FPGA、ADC?我给出3个理由
[c language] output students' names and scores in descending order of scores with structures