Skip to content
Snippets Groups Projects
Commit cd89c001 authored by Princelle Maxime's avatar Princelle Maxime :gay_pride_flag:
Browse files

:construction_worker: add CI deployment

parent 4467e011
Branches
Tags
1 merge request!4Add CI deployment
node_modules
\ No newline at end of file
kind: pipeline
type: docker
name: deploy
clone:
disable: true
steps:
- name: notif build start
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: "Drone Princelle (ERP: rms)"
avatar_url: https://s3.princelle.org/share/drone-ci.png
message: >
🚀 Starting deployment of **{{ repo.name }}** repo (*ERP*)...
**Commit from {{commit.author}} on {{commit.branch}}:**
{{commit.message}}
{{ build.link }}
- name: pull
image: appleboy/drone-ssh
settings:
host: flash.princelle.org
username: mprincelle
port: 22
key:
from_secret: ci_key
script:
- cd /app/uni/erp/rms
- git fetch --all
- git reset --hard origin/main
- git pull
- name: configure
image: appleboy/drone-ssh
settings:
host: flash.princelle.org
username: mprincelle
port: 22
key:
from_secret: ci_key
script:
- cd /app/uni/erp/rms
- echo -e "REACT_APP_BACK_API_KEY=theapikey" > .env
- echo -e "\nREACT_APP_BACK_URL=back.erp.uni.princelle.org" >> .env
- echo -e "\nAPP_PORT=2002" >> .env
- name: build
image: appleboy/drone-ssh
settings:
host: flash.princelle.org
username: mprincelle
port: 22
key:
from_secret: ci_key
script:
- cd /app/uni/erp/rms
- docker-compose up -d --build
- name: notif deploy done
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: "Drone Princelle (ERP: rms)"
avatar_url: https://s3.princelle.org/share/drone-ci.png
message: >
✅ Successfully deployed **{{ repo.name }}** repo (*ERP*) on Princelle Cloud!
**Commit from {{commit.author}} on {{commit.branch}}:**
{{commit.message}}
**App URL:** https://rms.erp.uni.princelle.org/
{{ build.link }}
when:
status:
- success
- name: notif deploy failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: "Drone Princelle (ERP: rms)"
avatar_url: https://s3.princelle.org/share/drone-ci.png
message: >
⚠️ Error on deploying **{{ repo.name }}** repo (*ERP*) on Princelle Cloud...
**Commit from {{commit.author}} on {{commit.branch}}:**
{{commit.message}}
{{ build.link }}
when:
status:
- failure
trigger:
branch:
- master
FROM node:16-alpine as build
WORKDIR /app
COPY . .
# Install & build
RUN yarn
RUN yarn build
# Production environment
FROM nginx:stable-alpine
COPY --from=build /app/build /usr/share/nginx/html
COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
version: '3.3'
services:
app:
container_name: erp-rms
restart: unless-stopped
build: .
ports:
- "${APP_PORT:-8889}:80"
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment