ci: traefik deploy

This commit is contained in:
Fernando Araoz 2024-12-15 22:00:13 -05:00
parent e74f910d03
commit fdcb1ccf98
2 changed files with 48 additions and 25 deletions

49
Jenkinsfile vendored
View File

@ -1,31 +1,30 @@
pipeline {
agent any
environment {
PATH = "/var/lib/jenkins/bin:/var/lib/jenkins/.nvm/versions/node/v20.9.0/bin:${env.PATH}"
}
stages {
stage('Install deps') {
agent {
agent any
stages {
stage('Build') {
agent {
docker {
reuseNode true
image 'node:22'
image 'node:22-alpine'
}
}
steps {
sh 'npm i -g pnpm'
sh 'pnpm i'
sh 'pnpm build'
}
}
stage('Deploy') {
steps {
// Clean previous deploy
sh 'rm -rf /var/www/dev.araozu.combi/assets /var/www/dev.araozu.combi/data /var/www/dev.araozu.combi/n'
// Check if the tiles folder exists. If it does not,
// extract the tiles
sh "if [ ! -d /var/www/dev.araozu.combi/tiles ]; then \n tar -xf tiles.tar.gz -C /var/www/dev.araozu.combi \n fi"
sh 'cp -r ./dist/* /var/www/dev.araozu.combi/'
}
}
}
steps {
sh 'npm i -g pnpm'
sh 'pnpm i'
sh 'pnpm build'
}
}
stage('Deploy') {
steps {
// Clean previous deploy
sh 'rm -rf /var/www/dev.araozu.combi/assets /var/www/dev.araozu.combi/data /var/www/dev.araozu.combi/n'
// Check if the tiles folder exists. If it does not,
// extract the tiles
sh "if [ ! -d /var/www/dev.araozu.combi/tiles ]; then \n tar -xf tiles.tar.gz -C /var/www/dev.araozu.combi \n fi"
sh 'cp -r ./dist/* /var/www/dev.araozu.combi/'
sh 'docker-compose down || true'
sh 'docker-compose up -d'
}
}
}
}

24
docker-compose.yml Normal file
View File

@ -0,0 +1,24 @@
services:
dev_araozu_combi:
image: nginx:alpine
restart: unless-stopped
container_name: dev_araozu_combi
volumes:
- /var/www/dev.araozu_combi/:/usr/share/nginx/html
labels:
- "traefik.enable=true"
- "traefik.http.routers.dev_araozu_combi.rule=Host(`combi.araozu.dev`)"
- "traefik.http.routers.dev_araozu_combi.entrypoints=websecure"
- "traefik.http.routers.dev_araozu_combi.tls=true"
- "traefik.http.routers.dev_araozu_combi.tls.certresolver=hetzner-resolver"
- "traefik.http.routers.dev_araozu_combi.tls.domains[0].main=araozu.dev"
- "traefik.http.routers.dev_araozu_combi.tls.domains[0].sans=*.araozu.dev"
networks:
- proxy
networks:
proxy:
name: proxy
external: true