Adds API, Angular shop/admin, docker compose, and .drone.yml for build + SSH deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
96 lines
1.9 KiB
YAML
96 lines
1.9 KiB
YAML
# Drone CI/CD for iLED shop
|
|
# Repo secrets (Drone UI → Settings → Secrets):
|
|
# ssh_host, ssh_user, ssh_key — deploy host
|
|
# ssh_port — optional, default 22
|
|
# deploy_path — absolute path on host (e.g. /opt/iled-shop)
|
|
#
|
|
# First-time host setup:
|
|
# git clone ssh://git@git.zea.lt:2222/miczek/iled-shop.git $DEPLOY_PATH
|
|
# cd $DEPLOY_PATH/docker && cp .env.example .env # then edit secrets
|
|
|
|
kind: pipeline
|
|
type: docker
|
|
name: ci
|
|
|
|
clone:
|
|
depth: 50
|
|
|
|
concurrency:
|
|
limit: 1
|
|
|
|
steps:
|
|
- name: api
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0
|
|
commands:
|
|
- cd src/backend
|
|
- dotnet restore iLED.sln
|
|
- dotnet build iLED.sln -c Release --no-restore
|
|
|
|
- name: shop
|
|
image: node:22-bookworm
|
|
commands:
|
|
- cd src/shop
|
|
- npm ci
|
|
- npm run build -- --configuration=production
|
|
|
|
- name: admin
|
|
image: node:22-bookworm
|
|
commands:
|
|
- cd src/admin
|
|
- npm ci
|
|
- npm run build -- --configuration=production
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
- pull_request
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
|
|
depends_on:
|
|
- ci
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
concurrency:
|
|
limit: 1
|
|
|
|
steps:
|
|
- name: ssh-deploy
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: ssh_host
|
|
username:
|
|
from_secret: ssh_user
|
|
key:
|
|
from_secret: ssh_key
|
|
port:
|
|
from_secret: ssh_port
|
|
script_stop: true
|
|
envs:
|
|
- DEPLOY_PATH
|
|
script:
|
|
- set -euo pipefail
|
|
- cd "${DEPLOY_PATH}"
|
|
- git fetch origin
|
|
- git checkout "${DRONE_COMMIT_SHA}"
|
|
- cd docker
|
|
- docker compose --profile full pull || true
|
|
- docker compose --profile full up -d --build --remove-orphans
|
|
- docker compose --profile full ps
|
|
environment:
|
|
DEPLOY_PATH:
|
|
from_secret: deploy_path
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
- main
|
|
event:
|
|
- push
|