133 lines
2.6 KiB
YAML
133 lines
2.6 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: looking-fullstack
|
|
|
|
steps:
|
|
# Install dependencies for both apps
|
|
- name: install-root
|
|
image: node:18-alpine
|
|
commands:
|
|
- npm ci
|
|
|
|
- name: install-frontend
|
|
image: node:18-alpine
|
|
commands:
|
|
- cd app && npm ci
|
|
depends_on:
|
|
- install-root
|
|
|
|
- name: install-backend
|
|
image: node:18-alpine
|
|
commands:
|
|
- cd backend && npm ci
|
|
depends_on:
|
|
- install-root
|
|
|
|
# Linting
|
|
- name: lint-frontend
|
|
image: node:18-alpine
|
|
commands:
|
|
- cd app && npm run lint
|
|
depends_on:
|
|
- install-frontend
|
|
|
|
- name: lint-backend
|
|
image: node:18-alpine
|
|
commands:
|
|
- cd backend && npm run lint
|
|
depends_on:
|
|
- install-backend
|
|
|
|
# Testing
|
|
- name: test-frontend
|
|
image: node:18-alpine
|
|
commands:
|
|
- cd app && npm run test:ci
|
|
depends_on:
|
|
- install-frontend
|
|
|
|
- name: test-backend
|
|
image: node:18-alpine
|
|
commands:
|
|
- cd backend && npm test
|
|
depends_on:
|
|
- install-backend
|
|
|
|
# Build
|
|
- name: build-frontend
|
|
image: node:18-alpine
|
|
commands:
|
|
- cd app && npm run build
|
|
depends_on:
|
|
- lint-frontend
|
|
- test-frontend
|
|
|
|
# Docker builds
|
|
- name: docker-build-frontend
|
|
image: plugins/docker
|
|
settings:
|
|
registry: git.mifi.dev:12023
|
|
repo: git.mifi.dev:12023/mifi/pfosi-looking-frontend
|
|
username:
|
|
from_secret: docker_username
|
|
password:
|
|
from_secret: docker_password
|
|
tags:
|
|
- latest
|
|
- ${DRONE_COMMIT_SHA:0:8}
|
|
dockerfile: app/Dockerfile
|
|
context: app
|
|
depends_on:
|
|
- build-frontend
|
|
when:
|
|
branch:
|
|
- master
|
|
- main
|
|
|
|
- name: docker-build-backend
|
|
image: plugins/docker
|
|
settings:
|
|
registry: git.mifi.dev:12023
|
|
repo: git.mifi.dev:12023/mifi/pfosi-looking-backend
|
|
username:
|
|
from_secret: docker_username
|
|
password:
|
|
from_secret: docker_password
|
|
tags:
|
|
- latest
|
|
- ${DRONE_COMMIT_SHA:0:8}
|
|
dockerfile: backend/Dockerfile
|
|
context: backend
|
|
depends_on:
|
|
- lint-backend
|
|
- test-backend
|
|
when:
|
|
branch:
|
|
- master
|
|
- main
|
|
|
|
# Deploy both services
|
|
- name: deploy-stack
|
|
image: curlimages/curl
|
|
commands:
|
|
- curl -X POST $PORTAINER_WEBHOOK_URL
|
|
environment:
|
|
PORTAINER_WEBHOOK_URL:
|
|
from_secret: portainer_webhook_fullstack
|
|
depends_on:
|
|
- docker-build-frontend
|
|
- docker-build-backend
|
|
when:
|
|
branch:
|
|
- master
|
|
- main
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
- main
|
|
- develop
|
|
event:
|
|
- push
|
|
- pull_request
|