[*] 修改为 group
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Failing after 9s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 18m11s

This commit is contained in:
Martin 2025-01-13 20:08:43 +08:00
commit b1688d45a8
8 changed files with 77 additions and 1 deletions

View File

@ -0,0 +1,29 @@
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 }}

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM scratch
COPY *.sh /scripts

View File

@ -5,6 +5,14 @@
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
# docker-ce
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
```

View File

@ -3,4 +3,10 @@
# apt + ntp
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
# 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

View File

@ -46,8 +46,14 @@ server ntp5.aliyun.com iburst
driftfile /var/lib/chrony/drift
allow 127.0.0.1
EOF
if pidof systemd >/dev/null 2>&1; then
systemctl restart chrony && systemctl enable chrony
else
echo "systemctl 不存在,跳过 chrony 的重启"
fi
# fix vim 粘贴
if ! grep -q "set pastetoggle=" ~/.vimrc; then
echo "set pastetoggle=" >> ~/.vimrc
fi

8
init-git.sh Normal file
View File

@ -0,0 +1,8 @@
#!/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

8
init-npm.sh Normal file
View File

@ -0,0 +1,8 @@
#!/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

8
init-pip.sh Normal file
View File

@ -0,0 +1,8 @@
#!/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