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

边栏推荐
- 牛客刷题——不要二
- 牛客刷题——part8
- 让我们的坦克欢快的动起来吧
- Realize that you can continue to play
- [c language] output the students with the highest scores with a structure. There can be multiple highest scores
- 使用Transformers将TF模型转化成PyTorch模型
- JS实现全屏展示的具体方法
- 记录一下phpstudy配置php8.0和php8.1扩展redis
- 力扣刷题——根据二叉树创建字符串
- [c language] limit the number of searches and output the maximum value found in the number of internal searches
猜你喜欢

* Jetpack 笔记 Room 的使用

【无标题】

TR-069 protocol introduction

2023年西安交通大学管理学院MPAcc提前批面试网报通知

使用Visdom对损失函数进行监控
![[c language] output the students with the highest scores with a structure. There can be multiple highest scores](/img/4e/836a8f717a2d9bf5f999a934ff4c91.png)
[c language] output the students with the highest scores with a structure. There can be multiple highest scores

On the sequence traversal of binary tree

Introduction to basic use and pit closure of BigDecimal

全国院校MBA、EMBA、MPA、MEM、提前面试(预面试)时间批次已出(持续更新中)-文都管联院

力扣刷题——二叉树的层序遍历
随机推荐
牛客刷题——求最小公倍数
Mysql从0到1的完全深入学习--阶段二---基础篇
力扣31 下一个排列
[c language] output the average score and the student data below or equal to the average score with the structure
Ubuntu installs PSQL and runs related commands
labelme进行图片数据标注
Niuke brush questions part8
[golang] leetcode - 349 Intersection of two arrays (hash table)
*Jetpack notes understanding of lifecycle ViewModel and livedata
5 minutes to understand the red, blue and purple in the attack and defense drill
Niu Ke's question -- finding the least common multiple
Modern application of LDAP directory server
高并发架构设计
Swagger2简单使用
The nearest common ancestor of binary tree
H.264概念
力扣刷题——二叉树的层序遍历
Niu Ke's questions -- two sorting methods
论高可用架构
Sorted circular linked list