ci: add Forgejo Actions workflow for build and deploy
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 5s
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 5s
This commit is contained in:
parent
0c87b70a4a
commit
927ec14e2d
2 changed files with 50 additions and 1 deletions
44
.forgejo/workflows/deploy.yml
Normal file
44
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
name: Build and Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: https://data.forgejo.org/actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.lilastudy.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
|
|
||||||
|
- name: Build API image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-t git.lilastudy.com/forgejo-lila/lila-api:latest \
|
||||||
|
--target runner \
|
||||||
|
-f apps/api/Dockerfile .
|
||||||
|
|
||||||
|
- name: Build Web image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-t git.lilastudy.com/forgejo-lila/lila-web:latest \
|
||||||
|
--target production \
|
||||||
|
--build-arg VITE_API_URL=https://api.lilastudy.com \
|
||||||
|
-f apps/web/Dockerfile .
|
||||||
|
|
||||||
|
- name: Push images
|
||||||
|
run: |
|
||||||
|
docker push git.lilastudy.com/forgejo-lila/lila-api:latest
|
||||||
|
docker push git.lilastudy.com/forgejo-lila/lila-web:latest
|
||||||
|
|
||||||
|
- name: Deploy via SSH
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
||||||
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \
|
||||||
|
"cd ~/lila-app && docker compose pull api web && docker compose up -d api web && docker image prune -f"
|
||||||
|
|
@ -7,6 +7,10 @@
|
||||||
|
|
||||||
## problems+thoughts
|
## problems+thoughts
|
||||||
|
|
||||||
|
### IMPORTANT
|
||||||
|
|
||||||
|
verify if hetzner domain needs to be pushed, theres a change on hetzner and some domains need to be migrated
|
||||||
|
|
||||||
### docker credential helper
|
### docker credential helper
|
||||||
|
|
||||||
WARNING! Your credentials are stored unencrypted in '/home/languagedev/.docker/config.json'.
|
WARNING! Your credentials are stored unencrypted in '/home/languagedev/.docker/config.json'.
|
||||||
|
|
@ -15,7 +19,8 @@ https://docs.docker.com/go/credential-store/
|
||||||
|
|
||||||
### vps setup
|
### vps setup
|
||||||
|
|
||||||
monitoring and logging (eg via chrootkit or rkhunter, logwatch/monit => mails daily with summary)
|
- monitoring and logging (eg via chrootkit or rkhunter, logwatch/monit => mails daily with summary)
|
||||||
|
- keep the vps clean (e.g. old docker images/containers)
|
||||||
|
|
||||||
### cd/ci pipeline
|
### cd/ci pipeline
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue