[*] 修复bash
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 12s
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 12s
This commit is contained in:
parent
2a1bac7666
commit
1158047f6f
@ -1,3 +1,3 @@
|
||||
FROM scratch
|
||||
|
||||
COPY *.sh /scripts
|
||||
COPY *.sh /scripts/
|
40
README.md
40
README.md
@ -16,58 +16,36 @@ curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-git.sh |
|
||||
# 初始化全部
|
||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-all.sh | bash
|
||||
```
|
||||
|
||||
#### Python 镜像源配置测试
|
||||
|
||||
```bash
|
||||
pip config set global.index-url https://mirrors.martin98.com/repository/pypi-group/simple
|
||||
```
|
||||
|
||||
#### NPM
|
||||
|
||||
```bash
|
||||
npm config set registry https://mirrors.martin98.com/repository/npm-group/
|
||||
```
|
||||
|
||||
#### dockerfile
|
||||
##### DEB822 格式
|
||||
```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) && \
|
||||
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 curl && update-ca-certificates
|
||||
```
|
||||
##### 传统格式
|
||||
```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
|
||||
```
|
||||
|
||||
#### 进入容器
|
||||
```bash
|
||||
docker compose run debian bash
|
||||
```
|
||||
```bash
|
||||
docker compose run ubuntu bash
|
||||
COPY --from=docker.martin98.com/martin_farm/init:latest /scripts /scripts
|
||||
RUN /scripts/init-apt.sh
|
||||
```
|
||||
|
||||
#### APT 镜像源配置测试
|
||||
|
||||
```bash
|
||||
docker compose run debian ./init-all.sh
|
||||
```
|
||||
|
||||
```bash
|
||||
docker compose run ubuntu ./init-all.sh
|
||||
```
|
||||
|
||||
```bash
|
||||
docker compose run ubuntu-2204 ./init-all.sh
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user