Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77fbafb571 |
-1
Submodule .ci/common deleted from 99f494f83f
@@ -1,12 +0,0 @@
|
||||
.git
|
||||
.gitignore
|
||||
.gitmodules
|
||||
|
||||
./Makefile
|
||||
|
||||
*.yml
|
||||
*.yaml
|
||||
|
||||
./LICENSE
|
||||
./README.md
|
||||
./img
|
||||
-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
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
# Ver: 1.11 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` 传入;如果未设置,则使用下面对应的默认值
|
||||
|
||||
ARG APP_NAME=alpine
|
||||
ARG APP_VER=3.23
|
||||
ARG REGISTRY_URL="docker.io/"
|
||||
ARG APT_SOURCE=aliyun
|
||||
|
||||
# 1. 生成镜像 =====================================================================
|
||||
FROM ${REGISTRY_URL}alpine:${APP_VER}
|
||||
|
||||
# 声明需要使用的全局可变参数(ARG声明的变量仅编译打包阶段有效)
|
||||
ARG APP_NAME
|
||||
ARG APP_VER
|
||||
ARG APT_SOURCE
|
||||
|
||||
# 镜像元数据标签 - 符合OCI镜像规范
|
||||
LABEL org.opencontainers.image.title="${APP_NAME}" \
|
||||
org.opencontainers.image.version="${APP_VER}" \
|
||||
org.opencontainers.image.description="Docker image for Alpine." \
|
||||
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 etc /etc/
|
||||
|
||||
# 拷贝默认的通用脚本文件
|
||||
COPY .ci/common/alpine /
|
||||
|
||||
RUN set -eux; \
|
||||
\
|
||||
select_source ${APT_SOURCE}; \
|
||||
\
|
||||
install_pkg bash tzdata dumb-init curl; \
|
||||
\
|
||||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime; \
|
||||
\
|
||||
apk add --no-cache libintl; \
|
||||
apk add --no-cache --virtual .locale_build git cmake make musl-dev gcc gettext-dev; \
|
||||
git clone https://gitlab.com/rilian-la-te/musl-locales; \
|
||||
cd musl-locales && sed -i '1i cmake_minimum_required(VERSION 3.10)' CMakeLists.txt && cmake -Wno-dev -DLOCALE_PROFILE=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install; \
|
||||
cd .. && rm -r musl-locales; \
|
||||
apk del .locale_build; \
|
||||
rm -rf /var/cache/apk/*;
|
||||
|
||||
# 在安装像相应软件包后,设置对应的环境变量
|
||||
ENV LANG=en_US.UTF-8 \
|
||||
LANGUAGE=en_US.UTF-8 \
|
||||
LC_ALL=en_US.UTF-8
|
||||
|
||||
# 应用程序的服务命令,必须使用非守护进程方式运行。如果使用变量,则该变量必须在运行环境中存在(ENV可以获取)
|
||||
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,101 +1,3 @@
|
||||
# Alpine
|
||||
|
||||
简单、高性能、小体积的基础 [Alpine](http://www.alpinelinux.org) 系统镜像,用于为其他应用提供基础镜像。
|
||||
|
||||
使用说明可参照:[官方说明](https://wiki.alpinelinux.org)
|
||||
|
||||
|
||||
**版本信息:**
|
||||
|
||||
- latest
|
||||
- 3.23、3.22、3.21
|
||||
|
||||
**镜像信息:**
|
||||
|
||||
* 镜像地址:
|
||||
* 华为云: swr.cn-north-4.myhuaweicloud.com/colovu/alpine
|
||||
* 依赖镜像:docker.io/library/alpine
|
||||
registry.colovu.com/docker-proxy/alpine
|
||||
|
||||
> 后续相关命令行默认使用华为云 SWR 镜像服务器做说明。
|
||||
|
||||
**与官方镜像差异:**
|
||||
|
||||
- 增加 `default、ustc、aliyun` 源配置文件,可在编译时通过 `ARG` 变量`APT_SOURCE`进行选择
|
||||
- 增加常用 Shell 脚本文件
|
||||
- 更新已安装的软件包
|
||||
- 增加`locales`,并设置默认编码格式为`en_US.utf8`
|
||||
- 设置默认时区信息为 `Asia/Shanghai`
|
||||
- 增加`bash`软件
|
||||
- 增加`dumb-init`软件,用作镜像的入口命令,以确保中断被正确响应和转发
|
||||
- 增加`curl`软件,用作镜像健康检查
|
||||
|
||||
## TL;DR
|
||||
|
||||
Docker 快速启动命令:
|
||||
|
||||
```shell
|
||||
# 从 Registry 服务器下载镜像并启动
|
||||
docker run -it swr.cn-north-4.myhuaweicloud.com/colovu/alpine /bin/bash
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 使用说明
|
||||
|
||||
**下载镜像:**
|
||||
|
||||
```shell
|
||||
docker pull swr.cn-north-4.myhuaweicloud.com/colovu/alpine:latest
|
||||
```
|
||||
|
||||
- latest:为镜像的 TAG,可针对性选择不同的 TAG 进行下载
|
||||
- 不指定 TAG 时,默认下载`latest`镜像
|
||||
|
||||
**查看镜像:**
|
||||
|
||||
```shell
|
||||
docker images
|
||||
```
|
||||
|
||||
**命令行方式运行容器:**
|
||||
|
||||
```shell
|
||||
docker run -it --rm swr.cn-north-4.myhuaweicloud.com/colovu/alpine /bin/bash
|
||||
```
|
||||
|
||||
- `-it`:使用交互式终端启动容器
|
||||
- `--rm`:退出时删除容器
|
||||
- `swr.cn-north-4.myhuaweicloud.com/colovu/alpine`:镜像名称及版本标签
|
||||
- `/bin/bash`:在容器中执行`/bin/bash`命令;如果不执行命令,容器会在启动后立即结束并退出。
|
||||
|
||||
以该方式启动后,直接进入容器的命令行操作界面。如果需要退出,直接使用命令`exit`退出。
|
||||
|
||||
**后台方式运行容器:**
|
||||
|
||||
```shell
|
||||
docker run -d --name alpine swr.cn-north-4.myhuaweicloud.com/colovu/alpine tail /dev/stderr
|
||||
```
|
||||
|
||||
- `--name alpine`:命名容器为`alpine`,可按照实际情况自定义容器名称
|
||||
- `-d`:以后台进程方式启动容器
|
||||
- `swr.cn-north-4.myhuaweicloud.com/colovu/alpine`:镜像名称及版本标签
|
||||
- `tail /dev/stderr`:在容器中执行`tail /dev/stderr`命令,以防止容器直接退出
|
||||
|
||||
以该方式启动后,如果想进入容器,可以使用以下命令:
|
||||
|
||||
```shell
|
||||
docker exec -it alpine /bin/bash
|
||||
```
|
||||
|
||||
- `-it`:使用交互式执行
|
||||
- `alpine`:之前启动的容器名
|
||||
- `/bin/bash`:执行的命令
|
||||
|
||||
## 更新记录
|
||||
|
||||
- 20260115: 更新为 v3.23.2
|
||||
|
||||
----
|
||||
|
||||
本文原始来源 [Endial Fang](https://gitee.com/colovu) @ [Gitee.com](https://gitee.com)
|
||||
停止维护 Alpine v3.20 版本.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Ver: 3.0 by Endial Fang (endial@126.com)
|
||||
#
|
||||
# Docker 镜像构建脚本 - 主入口
|
||||
|
||||
# 编译后镜像名称
|
||||
export IMAGE_NAME="alpine"
|
||||
# 依赖镜像的仓库地址(本镜像需要依赖原生 alpine 镜像)
|
||||
export REGISTRY_URL="swr.cn-north-4.myhuaweicloud.com/img-sync/docker.io/"
|
||||
# 源仓库地址(本地编译时,使用阿里云源仓库)
|
||||
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,2 +0,0 @@
|
||||
http://mirrors.aliyun.com/alpine/v3.23/main
|
||||
http://mirrors.aliyun.com/alpine/v3.23/community
|
||||
@@ -1,2 +0,0 @@
|
||||
http://dl-cdn.alpinelinux.org/alpine/v3.23/main
|
||||
http://dl-cdn.alpinelinux.org/alpine/v3.23/community
|
||||
@@ -1,2 +0,0 @@
|
||||
http://mirrors.ustc.edu.cn/alpine/v3.23/main
|
||||
http://mirrors.ustc.edu.cn/alpine/v3.23/community
|
||||
Reference in New Issue
Block a user