feat: Gitea CI workflow + registry image для деплоя
- .gitea/workflows/docker-build.yml: билд и пуш образа в Gitea Container Registry - docker-compose.server.yml: убрал build context, используем registry image - Требует REGISTRY_TOKEN секрет в настройках репо Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
33
.gitea/workflows/docker-build.yml
Normal file
33
.gitea/workflows/docker-build.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
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 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"
|
||||
Reference in New Issue
Block a user