feat: 新增 runtime-go 镜像(Go 1.23.12 / 1.22.12)

This commit is contained in:
2026-11-15 11:15:46 +08:00
parent c594cece2d
commit e427639817
8 changed files with 90 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
# 由 build.sh 预下载的 Go 压缩包经 ADD 解压进镜像,
# ADD 的源文件必须在构建上下文内,因此 *.tar.gz 不能在这里忽略
build.sh
.git/
.DS_Store
+3
View File
@@ -0,0 +1,3 @@
# 构建产物 / 本地缓存
*.tar.gz
.DS_Store
+19
View File
@@ -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;
+18
View File
@@ -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}"