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 { pipeline {
agent any agent any
environment { stages {
PATH = "/var/lib/jenkins/bin:/var/lib/jenkins/.nvm/versions/node/v20.9.0/bin:${env.PATH}" stage('Build') {
} agent {
stages {
stage('Install deps') {
agent {
docker { docker {
reuseNode true reuseNode true
image 'node:22' image 'node:22-alpine'
} }
} }
steps { steps {
sh 'npm i -g pnpm' sh 'npm i -g pnpm'
sh 'pnpm i' sh 'pnpm i'
sh 'pnpm build' sh 'pnpm build'
} }
} }
stage('Deploy') { stage('Deploy') {
steps { steps {
// Clean previous deploy // Clean previous deploy
sh 'rm -rf /var/www/dev.araozu.combi/assets /var/www/dev.araozu.combi/data /var/www/dev.araozu.combi/n' 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, // Check if the tiles folder exists. If it does not,
// extract the tiles // 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 "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 '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