73 lines
1.5 KiB
YAML
73 lines
1.5 KiB
YAML
kind: pipeline
|
|
name: klip
|
|
|
|
trigger:
|
|
branch:
|
|
- develop
|
|
|
|
steps:
|
|
- name: "setup postgres"
|
|
image: postgres:10.14-alpine
|
|
pull: if-not-exists
|
|
detach: true
|
|
commands:
|
|
- sleep 30
|
|
- psql -U postgres -c "CREATE USER klip WITH PASSWORD 'klip' SUPERUSER;" -h postgres
|
|
|
|
- name: "setup redis"
|
|
image: redis
|
|
pull: if-not-exists
|
|
detach: true
|
|
commands:
|
|
- sleep 5
|
|
- redis-cli -h redis ping
|
|
|
|
- name: "configure .env"
|
|
image: ubuntu
|
|
pull: if-not-exists
|
|
commands:
|
|
- cp .example.env .env
|
|
- sed -i 's/DB_HOST=localhost/DB_HOST=postgres/g' .env
|
|
- sed -i 's/DB_USER=/DB_USER=klip/g' .env
|
|
- sed -i 's/DB_PASSWORD=/DB_PASSWORD=klip/g' .env
|
|
- sed -i 's/REDIS_HOST="127.0.0.1"/REDIS_HOST="redis"/g' .env
|
|
- sed -i 's/DEFAULT_DOMAIN="localhost:3000"/DEFAULT_DOMAIN="0.0.0.0:3000"/g' .env
|
|
|
|
- name: "install node dependencies"
|
|
image: node
|
|
pull: if-not-exists
|
|
commands:
|
|
- npm install
|
|
|
|
- name: "build"
|
|
image: node
|
|
pull: if-not-exists
|
|
commands:
|
|
- npm run build
|
|
|
|
- name: "start"
|
|
image: node
|
|
pull: if-not-exists
|
|
detach: true
|
|
commands:
|
|
- npm start
|
|
|
|
- name: "check response"
|
|
image: inutano/wget
|
|
pull: if-not-exists
|
|
commands:
|
|
- wget --server-response http://start:3000/api/v2/health
|
|
|
|
services:
|
|
- name: postgres
|
|
image: postgres:10.14-alpine
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
|
|
- name: redis
|
|
image: redis
|
|
|
|
- name: start
|
|
image: node
|