1 Commits

Author SHA1 Message Date
admin 39425af43e Added possibility deploy with k3s 2026-05-26 23:02:11 +03:00
+27 -16
View File
@@ -11,7 +11,7 @@ jobs:
steps:
- name: Checkout code
uses: https://gitea.com/actions/checkout@v4
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -25,33 +25,44 @@ jobs:
- name: Build and push postgres image
uses: docker/build-push-action@v5
# if: |
# contains(github.event.commits[0].modified, 'infra/postgres') ||
# contains(github.event.commits[0].added, 'infra/postgres')
if: |
contains(github.event.commits[0].modified, 'infra/docker/postgres-pg-cron') ||
contains(github.event.commits[0].added, 'infra/docker/postgres-pg-cron')
with:
context: .
file: infra/postgres/Dockerfile
file: infra/docker/postgres-pg-cron/Dockerfile
push: true
tags: |
${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub-postgres:latest
${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub-postgres:${{ github.sha }}
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub-postgres:cache
cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub-postgres:cache,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push app image
uses: docker/build-push-action@v5
with:
context: .
file: infra/application/Dockerfile
file: infra/docker/application/Dockerfile
push: true
tags: |
${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:latest
${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:${{ github.sha }}
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:cache
cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USER }}/familyhub:cache,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Trigger deploy
# run: |
# curl -s -X POST \
# -H "X-Webhook-Secret: ${{ secrets.WEBHOOK_SECRET }}" \
# "http://10.0.0.2:9001/deploy?container=familyhub"
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Deploy to k3s
env:
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG }}
run: |
mkdir -p ~/.kube
echo "$KUBECONFIG_DATA" > ~/.kube/config
chmod 600 ~/.kube/config
kubectl rollout restart deployment/application -n family-hub
kubectl rollout restart deployment/postgres -n family-hub
kubectl rollout status deployment/application -n family-hub --timeout=120s
kubectl rollout status deployment/postgres -n family-hub --timeout=120s