43 lines
1.2 KiB
Bash
43 lines
1.2 KiB
Bash
#!/usr/bin/bash
|
||
#不包含创建kimi逆向api,创建kimiapi需要访问https://github.com/LLM-Red-Team/kimi-free-api
|
||
#docker部署一节,并修改配置文件。
|
||
# 创建gopath目录
|
||
mkdir /root/go
|
||
cd /root/go
|
||
|
||
# 获取go安装包(如果下载不了,可以直接去浏览器下载,然后上传到linux)
|
||
wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz
|
||
|
||
# 解压并加入/usr/local目录
|
||
tar -C /usr/local -zxf go1.22.1.linux-amd64.tar.gz
|
||
|
||
# 导出go环境变量
|
||
PROFILE_CONTENT="
|
||
export GOROOT=/usr/local/go
|
||
export GOPATH=/root/go
|
||
export GOPROXY=https://goproxy.cn,direct
|
||
export PATH=\$PATH:$GOROOT/bin:$GOPATH/bin
|
||
"
|
||
|
||
# 检查 /etc/profile 文件是否存在
|
||
if [ -f /etc/profile ]; then
|
||
# 使用 echo 命令和 >> 操作符追加内容到 /etc/profile 文件末尾
|
||
echo "$PROFILE_CONTENT" >> /etc/profile
|
||
echo "已成功添加配置到 /etc/profile。"
|
||
else
|
||
echo "/etc/profile 文件不存在。"
|
||
fi
|
||
|
||
# 刷新环境变量
|
||
source /etc/profile
|
||
|
||
# 查看go版本,检查是否安装成功
|
||
go version
|
||
#编译
|
||
cd cmd && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ../aiweek && cd ..
|
||
timestamp=$(date +%s)
|
||
#docker构建
|
||
docker build -t aiweek:$timestamp .
|
||
|
||
|
||
docker run -d --name aiweek -v /data:/data aiweek:$timestamp |