From e427639817421c6c9b039ea4808df92dc5eb2e1b Mon Sep 17 00:00:00 2001 From: Odboy Date: Sun, 15 Nov 2026 11:15:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20runtime-go=20?= =?UTF-8?q?=E9=95=9C=E5=83=8F=EF=BC=88Go=201.23.12=20/=201.22.12=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- image/runtime-go122/.dockerignore | 5 +++++ image/runtime-go122/.gitignore | 3 +++ image/runtime-go122/Dockerfile | 19 +++++++++++++++++++ image/runtime-go122/build.sh | 18 ++++++++++++++++++ image/runtime-go123/.dockerignore | 5 +++++ image/runtime-go123/.gitignore | 3 +++ image/runtime-go123/Dockerfile | 19 +++++++++++++++++++ image/runtime-go123/build.sh | 18 ++++++++++++++++++ 8 files changed, 90 insertions(+) create mode 100644 image/runtime-go122/.dockerignore create mode 100644 image/runtime-go122/.gitignore create mode 100644 image/runtime-go122/Dockerfile create mode 100755 image/runtime-go122/build.sh create mode 100644 image/runtime-go123/.dockerignore create mode 100644 image/runtime-go123/.gitignore create mode 100644 image/runtime-go123/Dockerfile create mode 100755 image/runtime-go123/build.sh diff --git a/image/runtime-go122/.dockerignore b/image/runtime-go122/.dockerignore new file mode 100644 index 0000000..2b69ca1 --- /dev/null +++ b/image/runtime-go122/.dockerignore @@ -0,0 +1,5 @@ +# 由 build.sh 预下载的 Go 压缩包经 ADD 解压进镜像, +# ADD 的源文件必须在构建上下文内,因此 *.tar.gz 不能在这里忽略 +build.sh +.git/ +.DS_Store diff --git a/image/runtime-go122/.gitignore b/image/runtime-go122/.gitignore new file mode 100644 index 0000000..9a1bb28 --- /dev/null +++ b/image/runtime-go122/.gitignore @@ -0,0 +1,3 @@ +# 构建产物 / 本地缓存 +*.tar.gz +.DS_Store diff --git a/image/runtime-go122/Dockerfile b/image/runtime-go122/Dockerfile new file mode 100644 index 0000000..81e6a02 --- /dev/null +++ b/image/runtime-go122/Dockerfile @@ -0,0 +1,19 @@ +FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:system-alinux3 +LABEL MAINTAINER="tianjun@odboy.cn" +ENV TimeZone=Asia/Shanghai +ENV GOROOT=/usr/local/go +ENV GOPATH=/home/admin/go +ENV PATH="${GOROOT}/bin:${GOPATH}/bin:$PATH" +WORKDIR /home/admin +# https://mirrors.aliyun.com/golang/go1.22.12.linux-amd64.tar.gz(官方源 https://go.dev/dl/) +# 由 build.sh 预先下载到本目录;解包后即为 go/ 目录 +ADD go1.22.12.linux-amd64.tar.gz /usr/local/ +# git:go get / go mod 拉取私有仓库;ca-certificates:https 访问模块代理; +# gcc:cgo 代码与部分依赖(如 sqlite、cgo 版 net)编译需要 +RUN set -e && yum install \ + git \ + gcc \ + ca-certificates \ + sysstat \ + net-tools -y; \ + go version; diff --git a/image/runtime-go122/build.sh b/image/runtime-go122/build.sh new file mode 100755 index 0000000..d9765df --- /dev/null +++ b/image/runtime-go122/build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# 先下载 Go 二进制包到当前目录,再基于本地文件构建镜像 +set -euo pipefail +cd "$(dirname "$0")" + +VERSION=1.22.12 +PKG=go${VERSION}.linux-amd64.tar.gz +URL=https://mirrors.aliyun.com/golang/${PKG} +# 镜像站不可达时的官方源(国内一般较慢) +FALLBACK=https://go.dev/dl/${PKG} + +if [ ! -f "${PKG}" ]; then + curl -fL -o "${PKG}" "${URL}" || curl -fL -o "${PKG}" "${FALLBACK}" +fi + +IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-go122 +docker build -t "${IMAGE}" . +docker push "${IMAGE}" diff --git a/image/runtime-go123/.dockerignore b/image/runtime-go123/.dockerignore new file mode 100644 index 0000000..2b69ca1 --- /dev/null +++ b/image/runtime-go123/.dockerignore @@ -0,0 +1,5 @@ +# 由 build.sh 预下载的 Go 压缩包经 ADD 解压进镜像, +# ADD 的源文件必须在构建上下文内,因此 *.tar.gz 不能在这里忽略 +build.sh +.git/ +.DS_Store diff --git a/image/runtime-go123/.gitignore b/image/runtime-go123/.gitignore new file mode 100644 index 0000000..9a1bb28 --- /dev/null +++ b/image/runtime-go123/.gitignore @@ -0,0 +1,3 @@ +# 构建产物 / 本地缓存 +*.tar.gz +.DS_Store diff --git a/image/runtime-go123/Dockerfile b/image/runtime-go123/Dockerfile new file mode 100644 index 0000000..ffe6a09 --- /dev/null +++ b/image/runtime-go123/Dockerfile @@ -0,0 +1,19 @@ +FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:system-alinux3 +LABEL MAINTAINER="tianjun@odboy.cn" +ENV TimeZone=Asia/Shanghai +ENV GOROOT=/usr/local/go +ENV GOPATH=/home/admin/go +ENV PATH="${GOROOT}/bin:${GOPATH}/bin:$PATH" +WORKDIR /home/admin +# https://mirrors.aliyun.com/golang/go1.23.12.linux-amd64.tar.gz(官方源 https://go.dev/dl/) +# 由 build.sh 预先下载到本目录;解包后即为 go/ 目录 +ADD go1.23.12.linux-amd64.tar.gz /usr/local/ +# git:go get / go mod 拉取私有仓库;ca-certificates:https 访问模块代理; +# gcc:cgo 代码与部分依赖(如 sqlite、cgo 版 net)编译需要 +RUN set -e && yum install \ + git \ + gcc \ + ca-certificates \ + sysstat \ + net-tools -y; \ + go version; diff --git a/image/runtime-go123/build.sh b/image/runtime-go123/build.sh new file mode 100755 index 0000000..391e448 --- /dev/null +++ b/image/runtime-go123/build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# 先下载 Go 二进制包到当前目录,再基于本地文件构建镜像 +set -euo pipefail +cd "$(dirname "$0")" + +VERSION=1.23.12 +PKG=go${VERSION}.linux-amd64.tar.gz +URL=https://mirrors.aliyun.com/golang/${PKG} +# 镜像站不可达时的官方源(国内一般较慢) +FALLBACK=https://go.dev/dl/${PKG} + +if [ ! -f "${PKG}" ]; then + curl -fL -o "${PKG}" "${URL}" || curl -fL -o "${PKG}" "${FALLBACK}" +fi + +IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-go123 +docker build -t "${IMAGE}" . +docker push "${IMAGE}"