Rebuild vpn proxy around gateway mode
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
name: Build and Deploy Sing-proxy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
DEPLOY_PATH: /opt/vpn-proxy
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone repository
|
||||
env:
|
||||
GIT_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
SERVER_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||
git clone --depth 2 "http://${{ gitea.actor }}:${GIT_TOKEN}@${SERVER_HOST}/${{ gitea.repository }}.git" .
|
||||
git checkout ${{ gitea.sha }}
|
||||
|
||||
- name: Build and push image
|
||||
run: |
|
||||
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}/sing-proxy"
|
||||
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY_HOST" -u "${{ gitea.actor }}" --password-stdin
|
||||
|
||||
docker build \
|
||||
-f docker/Dockerfile.singbox \
|
||||
-t "${IMAGE}:latest" \
|
||||
.
|
||||
|
||||
docker push "${IMAGE}:latest"
|
||||
echo "Pushed: ${IMAGE}:latest"
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: lxc-111
|
||||
steps:
|
||||
- name: Deploy to LXC 111
|
||||
run: |
|
||||
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}/sing-proxy"
|
||||
|
||||
echo "Logging into registry..."
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY_HOST" -u "${{ gitea.actor }}" --password-stdin
|
||||
|
||||
echo "Pulling latest image..."
|
||||
docker pull "${IMAGE}:latest"
|
||||
|
||||
echo "Stopping old container..."
|
||||
docker stop sing-proxy 2>/dev/null || true
|
||||
docker rm sing-proxy 2>/dev/null || true
|
||||
|
||||
echo "Starting new container..."
|
||||
docker run -d \
|
||||
--name sing-proxy \
|
||||
--network host \
|
||||
--restart unless-stopped \
|
||||
-e PORT=3456 \
|
||||
-e PROXY_PORT=8080 \
|
||||
-v ${{ env.DEPLOY_PATH }}/data:/app/data \
|
||||
--memory=256m \
|
||||
"${IMAGE}:latest"
|
||||
|
||||
echo "Deployment complete!"
|
||||
sleep 3
|
||||
docker ps | grep sing-proxy
|
||||
28
.gitea/workflows/gateway-build.yml
Normal file
28
.gitea/workflows/gateway-build.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Build Gateway Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone repository
|
||||
env:
|
||||
GIT_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
SERVER_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||
git clone --depth 2 "http://${{ gitea.actor }}:${GIT_TOKEN}@${SERVER_HOST}/${{ gitea.repository }}.git" .
|
||||
git checkout ${{ gitea.sha }}
|
||||
|
||||
- name: Build and push gateway image
|
||||
run: |
|
||||
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}/gateway"
|
||||
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY_HOST" -u "${{ gitea.actor }}" --password-stdin
|
||||
docker build -t "${IMAGE}:latest" -t "${IMAGE}:${{ gitea.sha }}" .
|
||||
docker push "${IMAGE}:latest"
|
||||
docker push "${IMAGE}:${{ gitea.sha }}"
|
||||
Reference in New Issue
Block a user