Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af2d65c0fd | |||
| 3aef2feb70 | |||
| 0a4e35db74 | |||
| e32c9a2513 | |||
| 2e67ecee4b | |||
| 9c721f834b | |||
| 76b09e3ba6 | |||
| b077953f59 | |||
| f7b6a74a5e | |||
| 3f5b3bb039 | |||
| e5d1b30cdd | |||
| 99588a0ed9 | |||
| b3a0dc5711 | |||
| b1f5929b6e | |||
| 2c951de029 | |||
| a3c5d92e1a | |||
| ac6b31d444 | |||
| cab104e8d7 | |||
| 5f0461ed86 | |||
| 77b87b64fc | |||
| 35f3b4d86b | |||
| 16f55dc1cd | |||
| ae8b2f07e3 |
-1
Submodule .ci/common deleted from b0ca0dc3a3
@@ -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
|
||||
-72
@@ -1,72 +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=debian
|
||||
ARG APP_VER=13
|
||||
ARG REGISTRY_URL="docker.io/"
|
||||
ARG APT_SOURCE=aliyun
|
||||
|
||||
# 1. 生成镜像 =====================================================================
|
||||
FROM ${REGISTRY_URL}debian:${APP_VER}-slim
|
||||
|
||||
# 声明需要使用的全局可变参数(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 Debian LTS Slim." \
|
||||
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 customer /
|
||||
|
||||
# 拷贝默认的通用脚本文件
|
||||
COPY .ci/common/debian /
|
||||
|
||||
# 选择软件包源,安装常用软件包,配置locale和时区,并清理缓存
|
||||
RUN set -eux; \
|
||||
\
|
||||
select_source ${APT_SOURCE}; \
|
||||
\
|
||||
install_pkg gosu dumb-init curl locales; \
|
||||
\
|
||||
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen; \
|
||||
locale-gen; \
|
||||
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_MESSAGES=POSIX; \
|
||||
dpkg-reconfigure -f noninteractive locales; \
|
||||
\
|
||||
ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime; \
|
||||
dpkg-reconfigure -f noninteractive tzdata; \
|
||||
\
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 在安装像相应软件包后,设置对应的环境变量
|
||||
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,140 +1,3 @@
|
||||
# Debian
|
||||
|
||||
[Debian 系统](https://www.debian.org/)的基础 Docker 镜像。基于官方 [Debian LTS Slim 版本](https://hub.docker.com/_/debian) 镜像。
|
||||
|
||||
**版本信息:**
|
||||
|
||||
- 13(trixie)、latest
|
||||
- 12(bookworm)
|
||||
|
||||
**镜像信息:**
|
||||
|
||||
* 镜像地址:
|
||||
* 华为云: swr.cn-north-4.myhuaweicloud.com/colovu/debian
|
||||
* 依赖镜像:docker.io/library/debian:12-slim
|
||||
registry.colovu.com/docker-proxy/debian:12-slim
|
||||
|
||||
> 后续相关命令行默认使用华为云 SWR 镜像服务器做说明。
|
||||
|
||||
**与官方镜像差异:**
|
||||
|
||||
- 增加 `default、ustc、aliyun` 源配置文件,可在编译时通过 `ARG` 变量`APT_SOURCE`进行选择
|
||||
- 增加常用 Shell 脚本文件
|
||||
- 更新已安装的软件包
|
||||
- 增加`locales`,并设置默认编码格式为`en_US.utf8`
|
||||
- 设置默认时区信息为 `Asia/Shanghai`
|
||||
- 增加`gosu`软件,用作镜像的 non-root 应用执行
|
||||
- 增加`dumb-init`软件,用作镜像的入口命令,以确保中断被正确响应和转发
|
||||
- 增加`curl`软件,用作镜像健康检查
|
||||
|
||||
## TL;DR
|
||||
|
||||
Docker 快速启动命令:
|
||||
|
||||
```shell
|
||||
# 从 Registry 服务器下载镜像并启动
|
||||
docker run -it swr.cn-north-4.myhuaweicloud.com/colovu/debian:latest /bin/bash
|
||||
```
|
||||
|
||||
- latest:为镜像的 TAG,可针对性选择不同的 TAG 进行下载
|
||||
- 不指定 TAG 时,默认下载`latest`镜像
|
||||
|
||||
---
|
||||
|
||||
## 使用说明
|
||||
|
||||
**下载镜像:**
|
||||
|
||||
```shell
|
||||
docker pull swr.cn-north-4.myhuaweicloud.com/colovu/debian:12
|
||||
```
|
||||
|
||||
- latest:为镜像的 TAG,可针对性选择不同的 TAG 进行下载
|
||||
- 不指定 TAG 时,默认下载`latest`镜像
|
||||
|
||||
**查看镜像:**
|
||||
|
||||
```shell
|
||||
docker images
|
||||
```
|
||||
|
||||
**命令行方式运行容器:**
|
||||
|
||||
```shell
|
||||
docker run -it --rm swr.cn-north-4.myhuaweicloud.com/colovu/debian:12 /bin/bash
|
||||
```
|
||||
|
||||
- `-it`:使用交互式终端启动容器
|
||||
- `--rm`:退出时删除容器
|
||||
- `swr.cn-north-4.myhuaweicloud.com/colovu/debian:12`:镜像名称及版本标签
|
||||
- `/bin/bash`:在容器中执行`/bin/bash`命令;如果不执行命令,容器会在启动后立即结束并退出。
|
||||
|
||||
以该方式启动后,直接进入容器的命令行操作界面。如果需要退出,直接使用命令`exit`退出。
|
||||
|
||||
**后台方式运行容器:**
|
||||
|
||||
```shell
|
||||
docker run -d --name debian swr.cn-north-4.myhuaweicloud.com/colovu/debian:12 tail /dev/stderr
|
||||
```
|
||||
|
||||
- `--name debian`:命名容器为`debian`,可按照实际情况自定义容器名称
|
||||
- `-d`:以后台进程方式启动容器
|
||||
- `swr.cn-north-4.myhuaweicloud.com/colovu/debian:12`:镜像名称及版本标签
|
||||
- `tail /dev/stderr`:在容器中执行`tail /dev/stderr`命令,以防止容器直接退出
|
||||
|
||||
以该方式启动后,如果想进入容器,可以使用以下命令:
|
||||
|
||||
```shell
|
||||
docker exec -it debian /bin/bash
|
||||
```
|
||||
|
||||
- `-it`:使用交互式执行
|
||||
- `debian`:之前启动的容器名
|
||||
- `/bin/bash`:执行的命令
|
||||
|
||||
## 配置修改
|
||||
|
||||
### 修改时区信息
|
||||
|
||||
可在生成镜像时或容器初始化 Shell 脚本中,使用以下命令:
|
||||
|
||||
```shell
|
||||
# 修改时区为 UTC
|
||||
ln -fs /usr/share/zoneinfo/UTC /etc/localtime
|
||||
|
||||
# 重新配置系统
|
||||
dpkg-reconfigure -f noninteractive tzdata
|
||||
```
|
||||
|
||||
更新成功后会显示当前时区信息,如:
|
||||
|
||||
```shell
|
||||
Current default time zone: 'Etc/UTC'
|
||||
Local time is now: Tue Jul 21 09:16:14 UTC 2020.
|
||||
Universal Time is now: Tue Jul 21 09:16:14 UTC 2020.
|
||||
```
|
||||
|
||||
### 修改字符编码格式
|
||||
|
||||
可在生成镜像时或容器初始化 Shell 脚本中,使用以下命令:
|
||||
|
||||
``` shell
|
||||
# 更改默认字符编码为 zh_CN.UTF-8
|
||||
sed -i -e 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
|
||||
update-locale LC_ALL=zh_CN.UTF-8 LANG=zh_CN.UTF-8 LANGUAGE=zh_CN.UTF-8 LC_MESSAGES=POSIX
|
||||
dpkg-reconfigure -f noninteractive locales
|
||||
|
||||
# 设置环境变量
|
||||
export LC_ALL=zh_CN.UTF-8 LANG=zh_CN.UTF-8 LANGUAGE=zh_CN.UTF-8
|
||||
```
|
||||
|
||||
更新成功后,可使用`locale`命令查看字符编码信息。
|
||||
|
||||
## 更新记录
|
||||
|
||||
- 20260115: 增加 v13 版本
|
||||
- 12、bookworm
|
||||
|
||||
----
|
||||
|
||||
本文原始来源 [Endial Fang](https://gitee.com/colovu) @ [Gitee.com](https://gitee.com)
|
||||
停止维护 Debian 11 版本.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Ver: 3.0 by Endial Fang (endial@126.com)
|
||||
#
|
||||
# Docker 镜像构建脚本 - 主入口
|
||||
|
||||
# 编译后镜像名称
|
||||
export IMAGE_NAME="debian"
|
||||
# 依赖镜像的仓库地址(本镜像需要依赖原生 debian 镜像)
|
||||
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,13 +0,0 @@
|
||||
Types: deb
|
||||
# http://snapshot.debian.org/archive/debian/20230703T000000Z
|
||||
URIs: http://mirrors.aliyun.com/debian
|
||||
Suites: trixie trixie-updates
|
||||
Components: main
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
|
||||
Types: deb
|
||||
# http://snapshot.debian.org/archive/debian-security/20230703T000000Z
|
||||
URIs: http://mirrors.aliyun.com/debian-security
|
||||
Suites: trixie-security
|
||||
Components: main
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
@@ -1,13 +0,0 @@
|
||||
Types: deb
|
||||
# http://snapshot.debian.org/archive/debian/20230703T000000Z
|
||||
URIs: http://deb.debian.org/debian
|
||||
Suites: trixie trixie-updates
|
||||
Components: main
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
|
||||
Types: deb
|
||||
# http://snapshot.debian.org/archive/debian-security/20230703T000000Z
|
||||
URIs: http://deb.debian.org/debian-security
|
||||
Suites: trixie-security
|
||||
Components: main
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
@@ -1,13 +0,0 @@
|
||||
Types: deb
|
||||
# http://snapshot.debian.org/archive/debian/20230703T000000Z
|
||||
URIs: http://mirrors.ustc.edu.cn/debian
|
||||
Suites: trixie trixie-updates
|
||||
Components: main
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
|
||||
Types: deb
|
||||
# http://snapshot.debian.org/archive/debian-security/20230703T000000Z
|
||||
URIs: http://mirrors.ustc.edu.cn/debian-security
|
||||
Suites: trixie-security
|
||||
Components: main
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
Reference in New Issue
Block a user