feat: update deployment workflow and docker-compose for Gitea integration
Some checks failed
Build & Deploy / build (push) Failing after 21s
Some checks failed
Build & Deploy / build (push) Failing after 21s
This commit is contained in:
@@ -1,24 +1,58 @@
|
|||||||
name: Deploy
|
name: Build & Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: ${{ vars.REGISTRY_URL }}/${{ github.repository_owner }}/slaapkampioen
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
# ── 1. Bouw de Docker image en push naar Gitea registry ──
|
||||||
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Deploy via SSH
|
- name: Log in to Gitea registry
|
||||||
uses: appleboy/ssh-action@master
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.DEPLOY_HOST }}
|
registry: ${{ vars.REGISTRY_URL }}
|
||||||
username: ${{ secrets.DEPLOY_USER }}
|
username: ${{ vars.REGISTRY_USER }}
|
||||||
key: ${{ secrets.DEPLOY_KEY }}
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
script: |
|
|
||||||
cd /opt/slaapkampioen
|
- name: Build & push
|
||||||
git pull
|
uses: docker/build-push-action@v5
|
||||||
docker compose build --no-cache
|
with:
|
||||||
docker compose up -d
|
context: .
|
||||||
docker compose logs --tail=20 app
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ env.IMAGE }}:latest
|
||||||
|
${{ env.IMAGE }}:${{ github.sha }}
|
||||||
|
|
||||||
|
# # ── 2. Deployen op de server via SSH ──
|
||||||
|
# deploy:
|
||||||
|
# needs: build
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - name: Deploy via SSH
|
||||||
|
# uses: appleboy/ssh-action@master
|
||||||
|
# with:
|
||||||
|
# host: ${{ vars.DEPLOY_HOST }}
|
||||||
|
# username: ${{ vars.DEPLOY_USER }}
|
||||||
|
# key: ${{ secrets.DEPLOY_KEY }}
|
||||||
|
# script: |
|
||||||
|
# # Inloggen op de Gitea registry (voor docker pull)
|
||||||
|
# echo "${{ secrets.REGISTRY_TOKEN }}" | \
|
||||||
|
# docker login ${{ vars.REGISTRY_URL }} \
|
||||||
|
# -u ${{ vars.REGISTRY_USER }} --password-stdin
|
||||||
|
|
||||||
|
# cd ${{ vars.DEPLOY_PATH }}
|
||||||
|
|
||||||
|
# # Nieuwste image pullen en container herstarten
|
||||||
|
# docker compose pull
|
||||||
|
# docker compose up -d
|
||||||
|
|
||||||
|
# # Oude images opruimen
|
||||||
|
# docker image prune -f
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build: .
|
# Image wordt gebuild door Gitea Actions en gepusht naar de registry.
|
||||||
|
# Vervang dit met jouw Gitea hostname + gebruikersnaam:
|
||||||
|
image: git.geyskens.eu/sam/slaapkampioenv2:latest
|
||||||
container_name: slaapkampioen
|
container_name: slaapkampioen
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
@@ -40,4 +42,4 @@ volumes:
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
internal:
|
internal:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
Reference in New Issue
Block a user