562c3770fb
Add a deploy workflow that builds and pushes the Docker image from the server working directory and runs docker compose on main. Trim CI to a focused Node build in an alpine container (apk deps, npm ci, npm run build) and remove the old docker workflow. Simplify Dockerfile to a builder+runtime flow (npm ci, npm prune, copy node_modules) and make docker-compose use the registry image and proxy network.
34 lines
980 B
YAML
34 lines
980 B
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: [ovh-vps-1, deploy, hiddenden]
|
|
steps:
|
|
- name: Pull latest code
|
|
working-directory: /home/ubuntu/appdata/Cozy-Den
|
|
run: |
|
|
git fetch origin
|
|
git reset --hard origin/main
|
|
|
|
- name: Login to Gitea registry
|
|
run: echo "${{ secrets.GITEA_TOKEN }}" | docker login git.hiddenden.cafe -u ${{ secrets.GITEA_USERNAME }} --password-stdin
|
|
|
|
- name: Build & push image
|
|
working-directory: /home/ubuntu/appdata/Cozy-Den
|
|
run: |
|
|
docker build -t git.hiddenden.cafe/hiddenden/cozy-den:latest .
|
|
docker push git.hiddenden.cafe/hiddenden/cozy-den:latest
|
|
|
|
- name: Deploy
|
|
working-directory: /home/ubuntu/appdata/Cozy-Den
|
|
env:
|
|
SECRET_KEY: ${{ secrets.SECRET_KEY }}
|
|
ADMIN_SECRET_TOKEN: ${{ secrets.ADMIN_SECRET_TOKEN }}
|
|
COOKIE_SECURE: "true"
|
|
run: docker compose up -d
|