44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
name: Deploy Backend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- '.gitea/workflows/deploy-backend.yml'
|
|
- 'backend/**'
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Keyscan
|
|
run: |
|
|
ssh-keyscan git.koptilnya.xyz >> ~/.ssh/known_hosts
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
ssh-strict: false
|
|
persist-credentials: false
|
|
|
|
- name: Build image
|
|
run: docker build -t tmc-backend ./backend
|
|
|
|
- name: Stop old container
|
|
run: docker rm -f tmc-backend || true
|
|
|
|
- name: Run
|
|
run: |
|
|
docker run -d \
|
|
--name tmc-backend \
|
|
--network traefik \
|
|
--label "traefik.enable=true" \
|
|
--label "traefik.http.routers.tmc-backend.rule=Host(\`api.koptilnya.xyz\`) && PathPrefix(\`/test-1\`)" \
|
|
--label "traefik.http.routers.tmc-backend.entrypoints=websecure" \
|
|
--label "traefik.http.routers.tmc-backend.tls=true" \
|
|
--label "traefik.http.routers.tmc-backend.tls.certresolver=myresolver" \
|
|
tmc-backend:latest
|