当前位置:网站首页>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 .

边栏推荐
- 最长严格递增子序列
- 5 minutes to understand the red, blue and purple in the attack and defense drill
- 平衡搜索二叉树——AVL树
- SQL注入漏洞学习之一:phpstudy集成环境搭建DVWA靶场
- [c language] output students' names and scores in descending order of scores with structures
- Feign shares login information for request
- Startup process of datanode
- MATLAB 保存imshow绘制图片到指定文件夹中的两种方法
- 牛客刷题——二叉搜索树与双向链表
- Mysql从0到1的完全深入学习--阶段二---基础篇
猜你喜欢
随机推荐
牛客刷题——part8
Force deduction questions -- create a string based on a binary tree
力扣33题,搜索旋转排序数组
用户组的操作
Introduction to basic use and pit closure of BigDecimal
制造出静态坦克
Financial bank_ Introduction to collection system
Balanced search binary tree -- AVL tree
Modern application of LDAP directory server
Function and principle of key in V-for
力扣刷题——二叉树的层序遍历Ⅱ
Startup process of datanode
新项目 搭建环境方法
264 Concepts
软件开发的整体流程
Map and set
Why is ti's GPMC parallel port more often used to connect FPGA and ADC? I give three reasons
Surveillance des fonctions de perte avec visdom
Niu Ke's questions -- two sorting methods
uni-app 慕客热搜项目实战(一)tabBar的制作







