From cd5a3456ab539e5e7b4651f184d8aa4e726930f4 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 1 May 2024 18:51:48 +0800 Subject: [PATCH] add Dockerfile and run.sh --- Dockerfile | 7 +++++++ run.sh | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Dockerfile create mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4f3a2a4 --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..7fa2d61 --- /dev/null +++ b/run.sh @@ -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