Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 265fa3ba6f | |||
| 2cb1ef14a8 | |||
| 9879e9dea0 | |||
| 63578e31fe | |||
| 10b6b564cb | |||
| ab90d73525 |
-1
Submodule .ci/common deleted from b0ca0dc3a3
@@ -1,57 +0,0 @@
|
||||
# 忽略所有 .git 相关
|
||||
.git
|
||||
.gitignore
|
||||
.gitmodules
|
||||
.gitattributes
|
||||
|
||||
# 忽略 IDE 和编辑器文件
|
||||
.idea/
|
||||
.vscode/
|
||||
*.iml
|
||||
Thumbs.db
|
||||
|
||||
# 忽略本地依赖和构建缓存
|
||||
node_modules/
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.env
|
||||
.env.*
|
||||
secrets/
|
||||
config/local.*
|
||||
|
||||
# 忽略日志和临时文件
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# 忽略测试报告(除非需要)
|
||||
coverage/
|
||||
htmlcov/
|
||||
.pytest_cache/
|
||||
|
||||
# 忽略 macOS 特有文件
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
|
||||
# 忽略构建产物(如果 Docker 内部会重新构建)
|
||||
dist/
|
||||
build/
|
||||
out/
|
||||
target/
|
||||
|
||||
# 忽略项目特有文件及目录
|
||||
img
|
||||
build.sh
|
||||
LICENSE
|
||||
README.md
|
||||
*.yml
|
||||
*.yaml
|
||||
|
||||
# 忽略 AI 规则文件
|
||||
.lingma
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
|
||||
Icon\r\r
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
@@ -1,3 +0,0 @@
|
||||
[submodule ".ci/common"]
|
||||
path = .ci/common
|
||||
url = https://git.colovu.com/docker/common.git
|
||||
@@ -1,55 +0,0 @@
|
||||
# 注意:
|
||||
# 1. git commit 信息中包含"[CI SKIP]"或"[SKIP CI]"则不触发工作流(注意大小写)
|
||||
# 2. 工作步骤中包含 volumes 挂载时,需在 Woodpecker 配置中添加 volumes 挂载信任(Trust)
|
||||
# 3. lables 配置项,可配置多个;如果存在,则必须完全符合 Runner 创建时设置的 Lables 配置项
|
||||
# 4. command 中,引用自定义变量不能使用`${VAR}`方式,需要使用`$VAR`方式;带花括号的变量,会在 Woodpecker 模板引擎解析阶段被替换(此时变量为空)
|
||||
# 5. 多架构编译后推送至 SWR 报错,或单架构编译后必须在推送时明确指定架构信息才能推送;可通过在编译命令中增加参数`--provenance=false --sbom=false`解决
|
||||
# 6. 使用 Git Submodule 管理通用脚本时,需手动更新 Submodule
|
||||
|
||||
when:
|
||||
# 匹配 main
|
||||
- event: push
|
||||
branch: main
|
||||
# 匹配 master
|
||||
- event: push
|
||||
branch: master
|
||||
# 匹配数字开头的分支,如 1.0, 2, 3.2.1
|
||||
- event: push
|
||||
branch: "[0-9]*"
|
||||
# 匹配 v 开头的版本分支,如 v1, v2.0
|
||||
- event: push
|
||||
branch: "v[0-9]*"
|
||||
# 匹配 tag 事件
|
||||
- event: tag
|
||||
ref: "refs/tags/(v?[0-9].*)"
|
||||
|
||||
labels:
|
||||
runtime: docker
|
||||
arch: amd64
|
||||
multiarch: "true"
|
||||
|
||||
steps:
|
||||
- name: 初始化子模块
|
||||
image: alpine/git
|
||||
commands:
|
||||
- git submodule update --init --recursive
|
||||
|
||||
- name: 编译并推送镜像
|
||||
image: docker:cli
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
SWR_REGISTRY: "swr.cn-north-4.myhuaweicloud.com"
|
||||
DOCKER_CLI_EXPERIMENTAL: enabled
|
||||
SWR_USERNAME:
|
||||
from_secret: swr_colovu_user
|
||||
SWR_PASSWORD:
|
||||
from_secret: swr_colovu_passwd
|
||||
commands:
|
||||
- |
|
||||
# 直接执行 Submodule .ci/common 下的构建推送脚本
|
||||
if [ ! -f ".ci/common/build_push.sh" ]; then
|
||||
echo "错误: 未找到 .ci/common/build_push.sh 脚本"
|
||||
exit 1
|
||||
fi
|
||||
- sh ./.ci/common/build_push.sh
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
# Ver: 1.12 by Endial Fang (endial@126.com)
|
||||
#
|
||||
|
||||
# 系统默认变量 ====================================================================
|
||||
# 该部分变量为系统根据编译命令默认设置
|
||||
# `TARGETPLATFORM`:构建后的目标平台信息。如 `linux/amd64`,`linux/arm/v7`,`windows/amd64`
|
||||
# `TARGETOS`:目标平台信息(TARGETPLATFORM)中的操作系统部分,如:`linux`、`windows`
|
||||
# `TARGETARCH`:目标平台信息(TARGETPLATFORM)中的平台架构部分,如:`amd64`、`arm`
|
||||
# `TARGETVARIANT`:目标平台信息(TARGETPLATFORM)中的版本变体部分,如:`v7`
|
||||
# `BUILDPLATFORM`:用于构建的节点平台信息
|
||||
# `BUILDOS`:用于构建的节点平台信息(BUILDPLATFORM)中的操作系统部分
|
||||
# `BUILDARCH`:用于构建的节点平台信息(BUILDPLATFORM)中的平台架构部分
|
||||
# `BUILDVARIANT`:用于构建的节点平台信息(BUILDPLATFORM)中的版本变体部分
|
||||
|
||||
# 可变参数 ========================================================================
|
||||
# 该部分变量,在编译命令中通过 `--build-arg` 传入;如果未设置,则使用下面对应的默认值
|
||||
# 依赖镜像下载地址: docker.io (默认) / swr.cn-north-4.myhuaweicloud.com/colovu/
|
||||
# apt源: default / aliyun / ustc
|
||||
# 软件包本地服务器: http://pkgs.colovu.com/dist
|
||||
|
||||
ARG APP_NAME=go
|
||||
ARG APP_VER=1.25.5
|
||||
ARG REGISTRY_URL="swr.cn-north-4.myhuaweicloud.com/colovu/"
|
||||
ARG APT_SOURCE=aliyun
|
||||
ARG LOCAL_URL=""
|
||||
|
||||
# 0. 预处理 ======================================================================
|
||||
FROM ${REGISTRY_URL}debian-builder:v13 AS builder
|
||||
|
||||
# 声明需要使用的全局可变参数
|
||||
ARG APP_NAME
|
||||
ARG APP_VER
|
||||
ARG APT_SOURCE
|
||||
ARG LOCAL_URL
|
||||
ARG TARGETARCH
|
||||
|
||||
# 下载并解压软件包
|
||||
# https://golang.google.cn/dl/go1.25.5.linux-amd64.tar.gz
|
||||
# https://golang.google.cn/dl/go1.25.5.linux-arm64.tar.gz
|
||||
RUN set -eux; \
|
||||
case "$TARGETARCH" in \
|
||||
amd64) appArch=x64 ;; \
|
||||
arm64) appArch=aarch64 ;; \
|
||||
arm) appArch=armhf ;; \
|
||||
*) echo "Unsupported architecture: $TARGETARCH" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
appName=${APP_NAME}${APP_VER}.linux-${TARGETARCH}.tar.gz; \
|
||||
[ -n ${LOCAL_URL} ] && localURL=${LOCAL_URL}/golang; \
|
||||
appUrls="${localURL:-} \
|
||||
https://golang.google.cn/dl \
|
||||
"; \
|
||||
download_pkg unpack ${appName} "${appUrls}"; \
|
||||
mv "/tmp/go" /usr/local/${APP_NAME};
|
||||
|
||||
# 1. 生成镜像 =====================================================================
|
||||
FROM ${REGISTRY_URL}debian:13
|
||||
|
||||
# 声明需要使用的全局可变参数(ARG声明的变量仅编译打包阶段有效)
|
||||
ARG APP_NAME
|
||||
ARG APP_VER
|
||||
|
||||
# 定义应用的基础信息变量(ENV声明的变量实例化后容器内有效)
|
||||
ENV APP_NAME=${APP_NAME} \
|
||||
APP_VER=${APP_VER} \
|
||||
\
|
||||
GOROOT="/usr/local/${APP_NAME}" \
|
||||
GOPATH="/srv/${APP_NAME}" \
|
||||
PATH="${PATH}:/usr/local/${APP_NAME}/bin"
|
||||
|
||||
# 镜像元数据标签 - 符合OCI镜像规范
|
||||
LABEL org.opencontainers.image.title="${APP_NAME}" \
|
||||
org.opencontainers.image.version="${APP_VER}" \
|
||||
org.opencontainers.image.description="Docker image for Golang." \
|
||||
org.opencontainers.image.authors="Endial Fang <endial@126.com>" \
|
||||
org.opencontainers.image.url="https://gitee.com/colovu/docker-${APP_NAME}" \
|
||||
org.opencontainers.image.vendor="Endial Fang (colovu)" \
|
||||
org.opencontainers.image.licenses="Apache-2.0" \
|
||||
org.opencontainers.image.source="https://gitee.com/colovu/docker-${APP_NAME}" \
|
||||
org.opencontainers.image.documentation="https://gitee.com/colovu/docker-${APP_NAME}/blob/main/README.md" \
|
||||
maintainer="Endial Fang <endial@126.com>"
|
||||
|
||||
# 拷贝多阶段构建结果输出及客制化脚本
|
||||
COPY --from=builder /usr/local/${APP_NAME} /usr/local/${APP_NAME}
|
||||
|
||||
RUN set -eux; \
|
||||
\
|
||||
mkdir -p /srv/${APP_NAME}; \
|
||||
\
|
||||
${APP_NAME} version;
|
||||
|
||||
# 配置容器的数据卷、工作目录
|
||||
VOLUME ["/srv/${APP_NAME}"]
|
||||
WORKDIR /srv/${APP_NAME}
|
||||
|
||||
CMD []
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Endial Fang (endial@126.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,38 +1,3 @@
|
||||
# 简介
|
||||
|
||||
针对 Golang 的 Docker 镜像,用于提供基础 Golang 开发环境。
|
||||
|
||||
使用说明可参考:[官方说明](https://golang.google.cn/doc/#)
|
||||
二进制文件下载:[Golang.CN](https://golang.google.cn/dl/)
|
||||
|
||||
<img src="img/go-logo-blue.svg" alt="Golang-logo" style="zoom: 150%;" />
|
||||
|
||||
**Golang 版本信息:**
|
||||
|
||||
- 1.25.5
|
||||
|
||||
**镜像信息:**
|
||||
|
||||
* 镜像地址:
|
||||
* 华为云: swr.cn-north-4.myhuaweicloud.com/colovu/golang:latest
|
||||
* 依赖镜像:swr.cn-north-4.myhuaweicloud.com/colovu/debian:13
|
||||
swr.cn-north-4.myhuaweicloud.com/colovu/debian-builder:13
|
||||
|
||||
> 后续相关命令行默认使用`[华为云 SWR](swr.cn-north-4.myhuaweicloud.com/colovu)`镜像服务器做说明
|
||||
|
||||
## TL;DR
|
||||
|
||||
基本验证命令:
|
||||
|
||||
```shell
|
||||
$ docker run -it --rm swr.cn-north-4.myhuaweicloud.com/colovu/golang:latest go version
|
||||
```
|
||||
|
||||
## 更新记录
|
||||
|
||||
- 2026/1/16: 添加 Golang 版本为 1.25.5
|
||||
|
||||
----
|
||||
|
||||
本文原始来源 [Endial Fang](https://github.com/colovu) @ [Github.com](https://github.com)
|
||||
|
||||
停止维护 v1.20 版本.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Ver: 3.0 by Endial Fang (endial@126.com)
|
||||
#
|
||||
# Docker 镜像构建脚本 - 主入口
|
||||
|
||||
# 编译后镜像名称
|
||||
export IMAGE_NAME="golang"
|
||||
# 依赖镜像的仓库地址
|
||||
export REGISTRY_URL="swr.cn-north-4.myhuaweicloud.com/colovu/"
|
||||
# 源仓库地址(本地编译时,使用阿里云源仓库)
|
||||
export APT_SOURCE="aliyun"
|
||||
# 针对无法直接下载到软件包,本地变异时,使用缓存的软件包
|
||||
export LOCAL_URL="http://pkgs.colovu.com/dist"
|
||||
|
||||
# 引入本地构建脚本
|
||||
if [ -f ".ci/common/build_local.sh" ]; then
|
||||
# 执行本地构建脚本并传递参数
|
||||
exec ".ci/common/build_local.sh" "$@"
|
||||
else
|
||||
echo "Error: .ci/common/build_local.sh script not found!"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1 +0,0 @@
|
||||
<svg height="78" viewBox="0 0 207 78" width="207" xmlns="http://www.w3.org/2000/svg"><g fill="#00acd7" fill-rule="evenodd"><path d="m16.2 24.1c-.4 0-.5-.2-.3-.5l2.1-2.7c.2-.3.7-.5 1.1-.5h35.7c.4 0 .5.3.3.6l-1.7 2.6c-.2.3-.7.6-1 .6z"/><path d="m1.1 33.3c-.4 0-.5-.2-.3-.5l2.1-2.7c.2-.3.7-.5 1.1-.5h45.6c.4 0 .6.3.5.6l-.8 2.4c-.1.4-.5.6-.9.6z"/><path d="m25.3 42.5c-.4 0-.5-.3-.3-.6l1.4-2.5c.2-.3.6-.6 1-.6h20c.4 0 .6.3.6.7l-.2 2.4c0 .4-.4.7-.7.7z"/><g transform="translate(55)"><path d="m74.1 22.3c-6.3 1.6-10.6 2.8-16.8 4.4-1.5.4-1.6.5-2.9-1-1.5-1.7-2.6-2.8-4.7-3.8-6.3-3.1-12.4-2.2-18.1 1.5-6.8 4.4-10.3 10.9-10.2 19 .1 8 5.6 14.6 13.5 15.7 6.8.9 12.5-1.5 17-6.6.9-1.1 1.7-2.3 2.7-3.7-3.6 0-8.1 0-19.3 0-2.1 0-2.6-1.3-1.9-3 1.3-3.1 3.7-8.3 5.1-10.9.3-.6 1-1.6 2.5-1.6h36.4c-.2 2.7-.2 5.4-.6 8.1-1.1 7.2-3.8 13.8-8.2 19.6-7.2 9.5-16.6 15.4-28.5 17-9.8 1.3-18.9-.6-26.9-6.6-7.4-5.6-11.6-13-12.7-22.2-1.3-10.9 1.9-20.7 8.5-29.3 7.1-9.3 16.5-15.2 28-17.3 9.4-1.7 18.4-.6 26.5 4.9 5.3 3.5 9.1 8.3 11.6 14.1.6.9.2 1.4-1 1.7z"/><path d="m107.2 77.6c-9.1-.2-17.4-2.8-24.4-8.8-5.9-5.1-9.6-11.6-10.8-19.3-1.8-11.3 1.3-21.3 8.1-30.2 7.3-9.6 16.1-14.6 28-16.7 10.2-1.8 19.8-.8 28.5 5.1 7.9 5.4 12.8 12.7 14.1 22.3 1.7 13.5-2.2 24.5-11.5 33.9-6.6 6.7-14.7 10.9-24 12.8-2.7.5-5.4.6-8 .9zm23.8-40.4c-.1-1.3-.1-2.3-.3-3.3-1.8-9.9-10.9-15.5-20.4-13.3-9.3 2.1-15.3 8-17.5 17.4-1.8 7.8 2 15.7 9.2 18.9 5.5 2.4 11 2.1 16.3-.6 7.9-4.1 12.2-10.5 12.7-19.1z" fill-rule="nonzero"/></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1 +0,0 @@
|
||||
<svg height="78" viewBox="0 0 207 78" width="207" xmlns="http://www.w3.org/2000/svg"><g fill="#ffffff" fill-rule="evenodd"><path d="m16.2 24.1c-.4 0-.5-.2-.3-.5l2.1-2.7c.2-.3.7-.5 1.1-.5h35.7c.4 0 .5.3.3.6l-1.7 2.6c-.2.3-.7.6-1 .6z"/><path d="m1.1 33.3c-.4 0-.5-.2-.3-.5l2.1-2.7c.2-.3.7-.5 1.1-.5h45.6c.4 0 .6.3.5.6l-.8 2.4c-.1.4-.5.6-.9.6z"/><path d="m25.3 42.5c-.4 0-.5-.3-.3-.6l1.4-2.5c.2-.3.6-.6 1-.6h20c.4 0 .6.3.6.7l-.2 2.4c0 .4-.4.7-.7.7z"/><g transform="translate(55)"><path d="m74.1 22.3c-6.3 1.6-10.6 2.8-16.8 4.4-1.5.4-1.6.5-2.9-1-1.5-1.7-2.6-2.8-4.7-3.8-6.3-3.1-12.4-2.2-18.1 1.5-6.8 4.4-10.3 10.9-10.2 19 .1 8 5.6 14.6 13.5 15.7 6.8.9 12.5-1.5 17-6.6.9-1.1 1.7-2.3 2.7-3.7-3.6 0-8.1 0-19.3 0-2.1 0-2.6-1.3-1.9-3 1.3-3.1 3.7-8.3 5.1-10.9.3-.6 1-1.6 2.5-1.6h36.4c-.2 2.7-.2 5.4-.6 8.1-1.1 7.2-3.8 13.8-8.2 19.6-7.2 9.5-16.6 15.4-28.5 17-9.8 1.3-18.9-.6-26.9-6.6-7.4-5.6-11.6-13-12.7-22.2-1.3-10.9 1.9-20.7 8.5-29.3 7.1-9.3 16.5-15.2 28-17.3 9.4-1.7 18.4-.6 26.5 4.9 5.3 3.5 9.1 8.3 11.6 14.1.6.9.2 1.4-1 1.7z"/><path d="m107.2 77.6c-9.1-.2-17.4-2.8-24.4-8.8-5.9-5.1-9.6-11.6-10.8-19.3-1.8-11.3 1.3-21.3 8.1-30.2 7.3-9.6 16.1-14.6 28-16.7 10.2-1.8 19.8-.8 28.5 5.1 7.9 5.4 12.8 12.7 14.1 22.3 1.7 13.5-2.2 24.5-11.5 33.9-6.6 6.7-14.7 10.9-24 12.8-2.7.5-5.4.6-8 .9zm23.8-40.4c-.1-1.3-.1-2.3-.3-3.3-1.8-9.9-10.9-15.5-20.4-13.3-9.3 2.1-15.3 8-17.5 17.4-1.8 7.8 2 15.7 9.2 18.9 5.5 2.4 11 2.1 16.3-.6 7.9-4.1 12.2-10.5 12.7-19.1z" fill-rule="nonzero"/></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
Reference in New Issue
Block a user