s2i

#include<iostream>
#include<sstream> 
#include<cstring>
#include<string>

using namespace std;
void s2i(int& num,string &str)
{
    stringstream ss;
    ss<<str;
    ss>>num;
}
int main()
{
  string str="789";
  int num;
  s2i(num,str);
  cout<<num<<endl;
  return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
以下是一个简单的 S2i 模板脚本示例: assemble 脚本: ``` #!/bin/bash echo "Building application..." # 编译应用程序 make # 拷贝应用程序到指定目录 cp /usr/src/app/app /tmp/src/ ``` run 脚本: ``` #!/bin/bash echo "Starting application..." # 启动应用程序 /tmp/src/app ``` save-artifacts 脚本: ``` #!/bin/bash echo "Saving artifacts..." # 保存应用程序的构建产物 cp /tmp/src/app /opt/app-root/src/ ``` Dockerfile 文件: ``` FROM centos:7 MAINTAINER Your Name <your.email@example.com> # 安装必要的依赖库 RUN yum -y install make gcc # 拷贝 assemble、run、save-artifacts 脚本到镜像中 COPY s2i/bin/assemble s2i/bin/run s2i/bin/save-artifacts /usr/local/bin/ # 设置应用程序的工作目录 WORKDIR /opt/app-root/src # 暴露应用程序的端口 EXPOSE 8080 # 设置应用程序的启动命令 CMD ["run"] ``` s2i 模板文件: ``` { "apiVersion": "template.openshift.io/v1", "kind": "Template", "metadata": { "name": "my-s2i-template", "annotations": { "description": "My S2I template" } }, "objects": [ { "apiVersion": "image.openshift.io/v1", "kind": "ImageStream", "metadata": { "name": "my-image-stream" } }, { "apiVersion": "build.openshift.io/v1", "kind": "BuildConfig", "metadata": { "name": "my-build-config" }, "spec": { "source": { "type": "Git", "git": { "uri": "<Git 仓库地址>", "ref": "master" } }, "strategy": { "type": "Source", "sourceStrategy": { "from": { "kind": "ImageStreamTag", "name": "centos:7" }, "scripts": { "assemble": "source /usr/local/bin/assemble", "run": "source /usr/local/bin/run", "save-artifacts": "source /usr/local/bin/save-artifacts" }, "incremental": false } }, "output": { "to": { "kind": "ImageStreamTag", "name": "my-image-stream:latest" } } } } ], "parameters": [ { "name": "GIT_URI", "required": true, "description": "Git 仓库地址" } ] } ``` 注:这只是一个简单的示例,具体的应用程序需要根据实际情况进行修改。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

同学yes

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值