Skip to content

Commit

Permalink
v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-ius committed Feb 24, 2025
1 parent b8b5228 commit 0b28690
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 139 deletions.
42 changes: 26 additions & 16 deletions .github/workflows/build-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,38 @@ on:
jobs:
build-deps:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push deps file
uses: docker/build-push-action@v6
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Convert tags to lowercase
run: |
dockerhub_tag="${{ secrets.DOCKERHUB_USERNAME }}"
ghcr_tag="ghcr.io/${{ github.repository }}"
repository="${{ github.repository }}"
repo_name="${repository#*/}"
echo "dockerhub_tag=${dockerhub_tag,,}" >> $GITHUB_ENV
echo "ghcr_tag=${ghcr_tag,,}" >> $GITHUB_ENV
echo "repo_name=${repo_name,,}" >> $GITHUB_ENV
- uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:deps"
file: Dockerfile
push: true
platforms: linux/amd64, linux/arm64, linux/s390x, linux/riscv64, linux/arm
tags: ${{ secrets.DOCKERHUB_USERNAME }}/docker-yarn-dev:deps
tags: |
${{ env.dockerhub_tag }}/${{ env.repo_name }}:deps
${{ env.ghcr_tag }}:deps
cache-from: type=gha
cache-to: type=gha,mode=max
38 changes: 15 additions & 23 deletions .github/workflows/build-pro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,35 @@ jobs:
permissions:
packages: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Convert tags to lowercase
- name: Convert tags to lowercase
run: |
dockerhub_tag="${{ secrets.DOCKERHUB_USERNAME }}"
ghcr_tag="ghcr.io/${{ github.repository_owner }}"
ghcr_tag="ghcr.io/${{ github.repository }}"
repository="${{ github.repository }}"
repo_name="${repository#*/}"
echo "dockerhub_tag=${dockerhub_tag,,}" >> $GITHUB_ENV
echo "ghcr_tag=${ghcr_tag,,}" >> $GITHUB_ENV
-
name: Build and push file
uses: docker/build-push-action@v6
echo "repo_name=${repo_name,,}" >> $GITHUB_ENV
- uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:pro"
file: Dockerfile
push: true
platforms: linux/amd64, linux/arm64, linux/s390x, linux/riscv64, linux/arm
tags: |
${{ env.dockerhub_tag }}/docker-yarn-dev:pro
${{ env.ghcr_tag }}/docker-yarn-dev:pro
${{ env.dockerhub_tag }}/${{ env.dockerhub_tag }}:pro
${{ env.ghcr_tag }}:pro
cache-from: type=gha
cache-to: type=gha,mode=max
38 changes: 15 additions & 23 deletions .github/workflows/build-ssh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,35 @@ jobs:
permissions:
packages: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Convert tags to lowercase
- name: Convert tags to lowercase
run: |
dockerhub_tag="${{ secrets.DOCKERHUB_USERNAME }}"
ghcr_tag="ghcr.io/${{ github.repository_owner }}"
ghcr_tag="ghcr.io/${{ github.repository }}"
repository="${{ github.repository }}"
repo_name="${repository#*/}"
echo "dockerhub_tag=${dockerhub_tag,,}" >> $GITHUB_ENV
echo "ghcr_tag=${ghcr_tag,,}" >> $GITHUB_ENV
-
name: Build and push file
uses: docker/build-push-action@v6
echo "repo_name=${repo_name,,}" >> $GITHUB_ENV
- uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:ssh"
file: Dockerfile
push: true
platforms: linux/amd64, linux/arm64, linux/s390x, linux/riscv64, linux/arm
tags: |
${{ env.dockerhub_tag }}/docker-yarn-dev:ssh
${{ env.ghcr_tag }}/docker-yarn-dev:ssh
${{ env.dockerhub_tag }}/${{ env.dockerhub_tag }}:ssh
${{ env.ghcr_tag }}:ssh
cache-from: type=gha
cache-to: type=gha,mode=max
38 changes: 15 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,35 @@ jobs:
permissions:
packages: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Convert tags to lowercase
- name: Convert tags to lowercase
run: |
dockerhub_tag="${{ secrets.DOCKERHUB_USERNAME }}"
ghcr_tag="ghcr.io/${{ github.repository_owner }}"
ghcr_tag="ghcr.io/${{ github.repository }}"
repository="${{ github.repository }}"
repo_name="${repository#*/}"
echo "dockerhub_tag=${dockerhub_tag,,}" >> $GITHUB_ENV
echo "ghcr_tag=${ghcr_tag,,}" >> $GITHUB_ENV
-
name: Build and push file
uses: docker/build-push-action@v6
echo "repo_name=${repo_name,,}" >> $GITHUB_ENV
- uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}"
file: Dockerfile
push: true
platforms: linux/amd64, linux/arm64, linux/s390x, linux/riscv64, linux/arm
tags: |
${{ env.dockerhub_tag }}/docker-yarn-dev
${{ env.ghcr_tag }}/docker-yarn-dev
${{ env.dockerhub_tag }}/${{ env.dockerhub_tag }}
${{ env.ghcr_tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
91 changes: 66 additions & 25 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,62 +41,77 @@ else
PROXY_PART=""
fi


MAIN_PART=$(cat <<EOF
{
"log": {
"disabled": false,
"level": "debug",
"level": "warn",
"timestamp": true
},
"experimental": {
"cache_file": {
"enabled": true,
"path": "cache.db",
"cache_id": "v1",
"store_fakeip": true
"store_fakeip": true,
"store_rdrc": true
}
},
"dns": {
"servers": [
{
"tag": "ND-h3",
"address": "h3://dns.nextdns.io/x",
"tag": "google",
"address": "https://dns.google/dns-query",
"address_resolver": "dns-direct",
"detour": "direct-out"
"client_subnet": "1.0.1.0",
"detour": "Proxy"
},
{
"tag": "dns-direct",
"address": "udp://223.5.5.5",
"address": "https://120.53.53.53/dns-query",
"detour": "direct-out"
}
],
"strategy": "ipv4_only",
"final": "ND-h3",
"rules": [
{
"outbound": "any",
"server": "dns-direct",
"action": "route"
},
{
"rule_set": "geosite-geolocation-cn",
"server": "dns-direct",
"action": "route"
}
],
"final": "google",
"reverse_mapping": true,
"disable_cache": false,
"disable_expire": false
},
"route": {
"final": "Proxy",
"auto_detect_interface": true,
"rules": [
{
"inbound": "tp-in",
"action": "sniff",
"sniffer": [
"dns",
"bittorrent",
"http",
"tls",
"quic",
"dtls"
]
"action": "sniff"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"rule_set": "geosite-geolocation-!cn",
"outbound": "Proxy"
},
{
"rule_set": [
"geoip-cn",
"geosite-geolocation-cn"
],
"outbound": "direct-out"
},
{
"ip_is_private": true,
"action": "route",
"outbound": "direct-out"
},
{
Expand All @@ -111,12 +126,39 @@ MAIN_PART=$(cat <<EOF
"240.0.0.0/4",
"52.80.0.0/16"
],
"action": "route",
"outbound": "direct-out"
}
],
"auto_detect_interface": true,
"final": "Proxy"
"rule_set": [
{
"tag": "geosite-geolocation-cn",
"type": "remote",
"format": "binary",
"url": "https://testingcf.jsdelivr.net/gh/lyc8503/sing-box-rules@rule-set-geosite/geosite-geolocation-cn.srs",
"download_detour": "direct-out"
},
{
"tag": "geosite-geolocation-!cn",
"type": "remote",
"format": "binary",
"url": "https://testingcf.jsdelivr.net/gh/lyc8503/sing-box-rules@rule-set-geosite/geosite-geolocation-!cn.srs",
"download_detour": "direct-out"
},
{
"tag": "geosite-category-ads-all",
"type": "remote",
"format": "binary",
"url": "https://testingcf.jsdelivr.net/gh/lyc8503/sing-box-rules@rule-set-geosite/geosite-category-ads-all.srs",
"download_detour": "direct-out"
},
{
"tag": "geoip-cn",
"type": "remote",
"format": "binary",
"url": "https://testingcf.jsdelivr.net/gh/lyc8503/sing-box-rules@rule-set-geoip/geoip-cn.srs",
"download_detour": "direct-out"
}
]
},
"outbounds": [
$PROXY_PART,
Expand All @@ -136,7 +178,6 @@ $PROXY_PART,
"tcp_fast_open": true,
"tcp_multi_path": false,
"udp_timeout": "5m",
"domain_strategy": "prefer_ipv4"
}
]
}
Expand Down
Loading

0 comments on commit 0b28690

Please sign in to comment.