1 Commits

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