- .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>
34 lines
1011 B
YAML
34 lines
1011 B
YAML
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"
|