Compare commits
No commits in common. "b1688d45a88fc4e3ee4752d9e41019b2a8b17476" and "28a83e30f5a9e42024e08929d942e0b2a220d98f" have entirely different histories.
b1688d45a8
...
28a83e30f5
@ -1,29 +0,0 @@
|
|||||||
name: Build Docker Image
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Explore-Gitea-Actions:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: https://git.martin98.com/actions/checkout.git@v4
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: https://git.martin98.com/actions/login-action.git@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.DOCKER_HUB }}
|
|
||||||
username: ${{ vars.DOCKER_USERNAME }}
|
|
||||||
password: ${{ vars.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: https://git.martin98.com/actions/build-push-action.git@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
docker.martin98.com/martin_farm/init:latest
|
|
||||||
docker.martin98.com/martin_farm/init:${{ github.sha }}
|
|
@ -1,3 +0,0 @@
|
|||||||
FROM scratch
|
|
||||||
|
|
||||||
COPY *.sh /scripts
|
|
39
README.md
39
README.md
@ -5,14 +5,6 @@
|
|||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
|
||||||
# docker-ce
|
# docker-ce
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash
|
||||||
# npm
|
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-npm.sh | bash
|
|
||||||
# pip
|
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-pip.sh | bash
|
|
||||||
# git
|
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-git.sh | bash
|
|
||||||
|
|
||||||
|
|
||||||
# 初始化全部
|
# 初始化全部
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-all.sh | bash
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-all.sh | bash
|
||||||
```
|
```
|
||||||
@ -25,32 +17,17 @@ pip config set global.index-url https://mirrors.martin98.com/repository/pypi-gro
|
|||||||
npm config set registry https://mirrors.martin98.com/repository/npm-group/
|
npm config set registry https://mirrors.martin98.com/repository/npm-group/
|
||||||
```
|
```
|
||||||
|
|
||||||
#### dockerfile
|
##### docker 容器中
|
||||||
##### DEB822 格式
|
|
||||||
```bash
|
```bash
|
||||||
RUN --mount=type=cache,target=/var/cache/apt \
|
RUN --mount=type=cache,target=/var/cache/apt \
|
||||||
--mount=type=cache,target=/var/lib/apt \
|
--mount=type=cache,target=/var/lib/apt \
|
||||||
APT_OPTIONS="-o Acquire::https::mirrors.martin98.com::Verify-Peer=false -o Acquire::https::mirrors.martin98.com::Verify-Host=false" \
|
sed -i '6,$d' /etc/apt/sources.list.d/dhttps://mirrors.mebian.sources && \
|
||||||
type=$(cat /etc/*release | grep ^ID= | cut -d= -f2) && \
|
sed -i 's|http://deb.debian.org/debian|artin98.com/repository/debian-tsinghua/|g' /etc/apt/sources.list.d/debian.sources && \
|
||||||
sed -i '6,$d' /etc/apt/sources.list.d/${type}.sources && \
|
apt update && \
|
||||||
sed -i "s|http://deb.debian.org/debian|https://mirrors.martin98.com/repository/${type}-tsinghua/|g" /etc/apt/sources.list.d/${type}.sources && \
|
apt install -y --no-install-recommends \
|
||||||
apt update $APT_OPTIONS && apt install $APT_OPTIONS -y ca-certificates curl && update-ca-certificates
|
gcc \
|
||||||
```
|
g++ \
|
||||||
##### 传统格式
|
python3-dev
|
||||||
```bash
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apt \
|
|
||||||
--mount=type=cache,target=/var/lib/apt \
|
|
||||||
APT_OPTIONS="-o Acquire::https::mirrors.martin98.com::Verify-Peer=false -o Acquire::https::mirrors.martin98.com::Verify-Host=false" \
|
|
||||||
type=$(cat /etc/*release | grep ^ID= | cut -d= -f2) && \
|
|
||||||
release=$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2) && \
|
|
||||||
components=$([ "${type}" = "debian" ] && echo "main contrib non-free non-free-firmware" || ([ "${type}" = "ubuntu" ] && echo "main restricted universe multiverse")) && \
|
|
||||||
|
|
||||||
echo "deb https://mirrors.martin98.com/repository/${type}-tsinghua-${release}${suite#noble}/ ${suite} ${components}"
|
|
||||||
|
|
||||||
echo "deb https://mirrors.martin98.com/repository/${type}-tsinghua-${release}/ ${suite} ${components}"
|
|
||||||
sed -i '6,$d' /etc/apt/sources.list.d/${type}.sources && \
|
|
||||||
sed -i "s|http://deb.debian.org/debian|https://mirrors.martin98.com/repository/${type}-tsinghua/|g" /etc/apt/sources.list.d/${type}.sources && \
|
|
||||||
apt update $APT_OPTIONS && apt install $APT_OPTIONS -y ca-certificates && update-ca-certificates
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 进入容器
|
#### 进入容器
|
||||||
|
@ -3,10 +3,4 @@
|
|||||||
# apt + ntp
|
# apt + ntp
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
|
||||||
# docker-ce
|
# docker-ce
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash
|
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash
|
||||||
# npm
|
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-npm.sh | bash
|
|
||||||
# pip
|
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-pip.sh | bash
|
|
||||||
# git
|
|
||||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-git.sh | bash
|
|
46
init-apt.sh
46
init-apt.sh
@ -1,30 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
type=$(cat /etc/*release | grep ^ID= | cut -d= -f2)
|
# 配置 ubuntu 源
|
||||||
release=$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2)
|
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
|
||||||
components=$([ "${type}" = "debian" ] && echo "main contrib non-free non-free-firmware" || ([ "${type}" = "ubuntu" ] && echo "main restricted universe multiverse"))
|
cat > /etc/apt/sources.list.d/ubuntu.sources <<EOF
|
||||||
|
Types: deb
|
||||||
# DEB822 格式
|
URIs: https://mirrors.martin98.com/repository/ubuntu-tsinghua/
|
||||||
# docker.martin98.com/library/ubuntu:latest
|
Suites: noble noble-updates noble-backports
|
||||||
# docker.martin98.com/library/debian:latest
|
Components: main restricted universe multiverse
|
||||||
if [ -f /etc/apt/sources.list.d/${type}.sources ]; then
|
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||||
cat > /etc/apt/sources.list.d/${type}.sources <<EOF
|
|
||||||
$(for suite in ${release} ${release}-updates ${release}-backports; do
|
|
||||||
echo "Types: deb"
|
|
||||||
echo "URIs: https://mirrors.martin98.com/repository/${type}-tsinghua-${suite}/"
|
|
||||||
echo "Suites: $suite"
|
|
||||||
echo "Components: ${components}"
|
|
||||||
echo "Signed-By: /usr/share/keyrings/${type}-archive-keyring.gpg"
|
|
||||||
echo
|
|
||||||
done)
|
|
||||||
EOF
|
EOF
|
||||||
# 传统格式
|
# 配置 debian 源
|
||||||
# docker.martin98.com/library/ubuntu:22.04
|
elif [ -f /etc/apt/sources.list.d/debian.sources ]; then
|
||||||
elif [ -f /etc/apt/sources.list ]; then
|
cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
||||||
cat > /etc/apt/sources.list <<EOF
|
Types: deb
|
||||||
$(for suite in ${release} ${release}-updates ${release}-backports; do
|
URIs: https://mirrors.martin98.com/repository/debian-tsinghua/
|
||||||
echo "deb https://mirrors.martin98.com/repository/${type}-tsinghua-${suite}/ ${suite} ${components}"
|
Suites: bookworm bookworm-updates bookworm-backports
|
||||||
done)
|
Components: main contrib non-free non-free-firmware
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "没有找到合适的源"
|
echo "没有找到合适的源"
|
||||||
@ -46,14 +38,8 @@ server ntp5.aliyun.com iburst
|
|||||||
driftfile /var/lib/chrony/drift
|
driftfile /var/lib/chrony/drift
|
||||||
allow 127.0.0.1
|
allow 127.0.0.1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if pidof systemd >/dev/null 2>&1; then
|
if pidof systemd >/dev/null 2>&1; then
|
||||||
systemctl restart chrony && systemctl enable chrony
|
systemctl restart chrony && systemctl enable chrony
|
||||||
else
|
else
|
||||||
echo "systemctl 不存在,跳过 chrony 的重启"
|
echo "systemctl 不存在,跳过 chrony 的重启"
|
||||||
fi
|
|
||||||
|
|
||||||
# fix vim 粘贴
|
|
||||||
if ! grep -q "set pastetoggle=" ~/.vimrc; then
|
|
||||||
echo "set pastetoggle=" >> ~/.vimrc
|
|
||||||
fi
|
fi
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# 检查 git 是否安装
|
|
||||||
if command -v pip &> /dev/null; then
|
|
||||||
echo "git 已安装,正在配置镜像源..."
|
|
||||||
git config --global url."https://git-proxy.hk.martin98.com/".insteadOf "https://"
|
|
||||||
echo "镜像源配置完成。"
|
|
||||||
fi
|
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# 检查 npm 是否安装
|
|
||||||
if command -v npm &> /dev/null; then
|
|
||||||
echo "npm 已安装,正在配置镜像源..."
|
|
||||||
npm config set registry https://mirrors.martin98.com/repository/npm-group/
|
|
||||||
echo "镜像源配置完成。"
|
|
||||||
fi
|
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# 检查 pip 是否安装
|
|
||||||
if command -v pip &> /dev/null; then
|
|
||||||
echo "pip 已安装,正在配置镜像源..."
|
|
||||||
pip config set global.index-url https://mirrors.martin98.com/repository/pypi-group/simple
|
|
||||||
echo "镜像源配置完成。"
|
|
||||||
fi
|
|
Loading…
x
Reference in New Issue
Block a user