dev
Administrator 2024-05-20 01:51:46 +08:00
parent 1e3f760be6
commit 80de9f4a9c
2 changed files with 3 additions and 35 deletions

View File

@ -1,8 +1,8 @@
FROM centos:7
USER root
ENV TZ=Asia/Shanghai
COPY aiweek /usr/local/bin/ \
./option/option.yaml /conf/
COPY aiweek /usr/local/bin/
COPY ./option/option.yaml /conf/
RUN chmod +x /usr/local/bin/aiweek && mkdir /data /conf
ENTRYPOINT ["aiweek"]
CMD ["--livemode=false"]

View File

@ -1,40 +1,8 @@
#!/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 ..
cd ./cmd && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ../aiweek && cd ..
timestamp=$(date +%s)
#docker构建
docker build -t aiweek:$timestamp .