更新 apt docker
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Has been cancelled
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Has been cancelled
This commit is contained in:
parent
6f8cd5cc22
commit
7beb4ca57f
@ -6,15 +6,18 @@ x-app-config: &app-config
|
|||||||
- ./:/app
|
- ./:/app
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
alpine:
|
||||||
|
<<: *app-config
|
||||||
|
image: alpine:latest
|
||||||
|
|
||||||
debian:
|
debian:
|
||||||
<<: *app-config
|
<<: *app-config
|
||||||
image: docker.martin98.com/library/debian:latest
|
image: debian:latest
|
||||||
|
|
||||||
ubuntu:
|
ubuntu:
|
||||||
<<: *app-config
|
<<: *app-config
|
||||||
image: docker.martin98.com/library/ubuntu:latest
|
image: ubuntu:latest
|
||||||
|
|
||||||
ubuntu-2204:
|
ubuntu-2204:
|
||||||
<<: *app-config
|
<<: *app-config
|
||||||
image: docker.martin98.com/library/ubuntu:22.04
|
image: ubuntu:22.04
|
@ -93,7 +93,7 @@ if [ -z "$CHANNEL" ]; then
|
|||||||
CHANNEL=$DEFAULT_CHANNEL_VALUE
|
CHANNEL=$DEFAULT_CHANNEL_VALUE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEFAULT_DOWNLOAD_URL="https://mirrors.martin98.com/repository/docker-ce/"
|
DEFAULT_DOWNLOAD_URL="https://reg.martin98.com/repository/docker-ce/"
|
||||||
#DEFAULT_DOWNLOAD_URL="https://download.docker.com"
|
#DEFAULT_DOWNLOAD_URL="https://download.docker.com"
|
||||||
if [ -z "$DOWNLOAD_URL" ]; then
|
if [ -z "$DOWNLOAD_URL" ]; then
|
||||||
DOWNLOAD_URL=$DEFAULT_DOWNLOAD_URL
|
DOWNLOAD_URL=$DEFAULT_DOWNLOAD_URL
|
||||||
|
47
init-apt.sh
47
init-apt.sh
@ -1,6 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
APT_OPTIONS="-o Acquire::https::mirrors.martin98.com::Verify-Peer=false -o Acquire::https::mirrors.martin98.com::Verify-Host=false"
|
# Alpine 相关处理
|
||||||
|
handle_alpine() {
|
||||||
|
echo "检测到 Alpine,切换 apk 源..."
|
||||||
|
sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://reg.martin98.com/repository/alpine#g' /etc/apk/repositories
|
||||||
|
|
||||||
|
echo "安装 openntpd 和 vim..."
|
||||||
|
apk update
|
||||||
|
apk add --no-cache openntpd vim
|
||||||
|
|
||||||
|
# 启动并设置 openntpd 开机自启
|
||||||
|
rc-service openntpd restart
|
||||||
|
rc-update add openntpd default
|
||||||
|
|
||||||
|
# 配置 vim 粘贴
|
||||||
|
if ! grep -q "set pastetoggle=" ~/.vimrc; then
|
||||||
|
echo "set pastetoggle=" >> ~/.vimrc
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Debian/Ubuntu 相关处理
|
||||||
|
handle_debian_ubuntu() {
|
||||||
|
APT_OPTIONS="-o Acquire::https::reg.martin98.com::Verify-Peer=false -o Acquire::https::reg.martin98.com::Verify-Host=false"
|
||||||
lsb_dist=$(cat /etc/*release | grep ^ID= | cut -d= -f2) # ubuntu or debian?
|
lsb_dist=$(cat /etc/*release | grep ^ID= | cut -d= -f2) # ubuntu or debian?
|
||||||
release=$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2) # ubuntu(jammy oracular) debian(bookworm)....
|
release=$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2) # ubuntu(jammy oracular) debian(bookworm)....
|
||||||
components=$([ "${lsb_dist=}" = "debian" ] && echo "main contrib non-free non-free-firmware" || ([ "${lsb_dist=}" = "ubuntu" ] && echo "main restricted universe multiverse"))
|
components=$([ "${lsb_dist=}" = "debian" ] && echo "main contrib non-free non-free-firmware" || ([ "${lsb_dist=}" = "ubuntu" ] && echo "main restricted universe multiverse"))
|
||||||
@ -11,23 +32,26 @@ if [ -f /etc/apt/sources.list.d/${lsb_dist}.sources ]; then
|
|||||||
fi
|
fi
|
||||||
# 配置镜像源
|
# 配置镜像源
|
||||||
cat <<EOF > /etc/apt/sources.list
|
cat <<EOF > /etc/apt/sources.list
|
||||||
deb https://mirrors.martin98.com/repository/$lsb_dist $release $components
|
deb https://reg.martin98.com/repository/$lsb_dist $release $components
|
||||||
deb https://mirrors.martin98.com/repository/$lsb_dist $release-updates $components
|
deb https://reg.martin98.com/repository/$lsb_dist $release-updates $components
|
||||||
deb https://mirrors.martin98.com/repository/$lsb_dist $release-backports $components
|
deb https://reg.martin98.com/repository/$lsb_dist $release-backports $components
|
||||||
deb https://mirrors.martin98.com/repository/$lsb_dist $release-security $components
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
for RELEASE in "$@"; do
|
for RELEASE in "$@"; do
|
||||||
echo "deb https://mirrors.martin98.com/repository/$lsb_dist $RELEASE $components" >> /etc/apt/sources.list
|
echo "deb https://reg.martin98.com/repository/$lsb_dist $RELEASE $components" >> /etc/apt/sources.list
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# 关闭交互式弹窗
|
# 关闭交互式弹窗
|
||||||
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||||
|
|
||||||
apt update $APT_OPTIONS && apt install $APT_OPTIONS -y ca-certificates curl && update-ca-certificates
|
apt update $APT_OPTIONS && apt install $APT_OPTIONS -y ca-certificates curl && update-ca-certificates
|
||||||
apt update && apt upgrade -y
|
apt update && apt upgrade -y
|
||||||
|
|
||||||
|
# 检查并安装 vim
|
||||||
|
if ! command -v vim >/dev/null 2>&1; then
|
||||||
|
apt install $APT_OPTIONS -y vim
|
||||||
|
fi
|
||||||
|
|
||||||
# NTP
|
# NTP
|
||||||
# 启用阿里云 ntp
|
# 启用阿里云 ntp
|
||||||
if pidof systemd >/dev/null 2>&1; then
|
if pidof systemd >/dev/null 2>&1; then
|
||||||
@ -48,3 +72,12 @@ fi
|
|||||||
if ! grep -q "set pastetoggle=" ~/.vimrc; then
|
if ! grep -q "set pastetoggle=" ~/.vimrc; then
|
||||||
echo "set pastetoggle=" >> ~/.vimrc
|
echo "set pastetoggle=" >> ~/.vimrc
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 主流程
|
||||||
|
if grep -qi 'alpine' /etc/*release; then
|
||||||
|
handle_alpine
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
handle_debian_ubuntu "$@"
|
||||||
|
fi
|
@ -22,9 +22,9 @@ elif command_exists docker; then
|
|||||||
else
|
else
|
||||||
# docker
|
# docker
|
||||||
if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ]; then
|
if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ]; then
|
||||||
curl -fsSL https://mirrors.martin98.com/repository/docker-ce/linux/$lsb_dist/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
curl -fsSL https://reg.martin98.com/repository/docker-ce/linux/$lsb_dist/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
fi
|
fi
|
||||||
echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.martin98.com/repository/docker-ce/linux/$lsb_dist $release stable" > /etc/apt/sources.list.d/docker.list
|
echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://reg.martin98.com/repository/docker-ce/linux/$lsb_dist $release stable" > /etc/apt/sources.list.d/docker.list
|
||||||
|
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/docker-install.sh | sh
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/docker-install.sh | sh
|
||||||
fi
|
fi
|
||||||
@ -32,9 +32,7 @@ fi
|
|||||||
cat > /etc/docker/daemon.json <<EOF
|
cat > /etc/docker/daemon.json <<EOF
|
||||||
{
|
{
|
||||||
"registry-mirrors": [
|
"registry-mirrors": [
|
||||||
"https://docker.martin98.com",
|
"https://docker.martin98.com"
|
||||||
"https://docker.mirrors.martin98.com",
|
|
||||||
"https://registry-docker.martin98.com",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user