add Dockerfile and run.sh

main
Administrator 2024-05-01 18:51:48 +08:00
parent 23ca747cb9
commit cd5a3456ab
2 changed files with 21 additions and 0 deletions

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM alpine:latest
USER root
RUN apk --no-cache add tzdata
ENV TZ=Asia/Shanghai
COPY ai-week /usr/local/bin
RUN chmod +x /usr/local/bin/ai-week
ENTRYPOINT ["ai-week"]

14
run.sh Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#安装golang1.22.2
wget https://golang.google.cn/dl/go1.22.2.linux-amd64.tar.gz
tar -zxvf go1.22.2.linux-amd64.tar.gz -C /usr/local/
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go version
#编译
cd ./cmd
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ../ai-week
#镜像
docker build -t ai-week:v2 .
sleep 3
docker run --name week -d --restart always ai-week:v2