Chaned fixed values to variables
Some checks failed
Build and Deploy Container / build_and_deploy (push) Has been cancelled
Some checks failed
Build and Deploy Container / build_and_deploy (push) Has been cancelled
This commit is contained in:
@@ -1,5 +1,14 @@
|
|||||||
name: Build and Deploy Container
|
name: Build and Deploy Container
|
||||||
|
|
||||||
|
env:
|
||||||
|
TARGET_HOST: www.valtrix.systems
|
||||||
|
TARGET_USER: traefik
|
||||||
|
APP_DIR: /home/traefik/app
|
||||||
|
CONTAINER_NAME: valtrix-website
|
||||||
|
QUADLET_FILE: valtrix-website.container
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -15,19 +24,25 @@ jobs:
|
|||||||
|
|
||||||
- name: Copy code to target host
|
- name: Copy code to target host
|
||||||
run: |
|
run: |
|
||||||
rsync -avz --delete ./ user@zielserver:/home/user/app/
|
rsync -az --delete ./ $TARGET_USER@$TARGET_HOST:$APP_DIR/
|
||||||
|
|
||||||
- name: Build container on target host
|
- name: Build container on target host
|
||||||
run: |
|
run: |
|
||||||
ssh user@zielserver '
|
ssh $TARGET_USER@$TARGET_HOST '
|
||||||
cd /home/user/app
|
cd $APP_DIR
|
||||||
podman build -t myapp:latest .
|
podman build -t $CONTAINER_NAME:latest .
|
||||||
|
'
|
||||||
|
|
||||||
|
- name: Backup Quadlet file
|
||||||
|
run: |
|
||||||
|
ssh $TARGET_USER@$TARGET_HOST '
|
||||||
|
cp ~/.config/containers/systemd/$CONTAINER_NAME.container ~/.config/containers/systemd/$CONTAINER_NAME.container.bak
|
||||||
'
|
'
|
||||||
|
|
||||||
- name: Replace Quadlet file
|
- name: Replace Quadlet file
|
||||||
run: |
|
run: |
|
||||||
scp ./systemd/myapp.container user@zielserver:~/.config/containers/systemd/
|
scp ./$QUADLET_FILE $TARGET_USER@$TARGET_HOST:~/.config/containers/systemd/
|
||||||
ssh user@zielserver '
|
ssh $TARGET_USER@$TARGET_HOST '
|
||||||
systemctl --user daemon-reload
|
systemctl --user daemon-reload
|
||||||
systemctl --user restart myapp.service
|
systemctl --user restart $CONTAINER_NAME.service
|
||||||
'
|
'
|
||||||
Reference in New Issue
Block a user