feat: deploy with traefik

This commit is contained in:
Fernando Araoz 2024-12-15 21:29:25 -05:00
parent 1fc1cf1c83
commit 2c8c1eacdf
2 changed files with 34 additions and 11 deletions

22
Jenkinsfile vendored
View File

@ -1,22 +1,20 @@
pipeline { pipeline {
agent { agent {
docker { docker {
image 'node:22' image 'node:22'
} }
} }
stages { stages {
stage('Install pnpm') { stage("Build") {
agent {
docker {
image 'node:22-alpine'
reuseNode true
}
}
steps { steps {
sh 'npm i -g pnpm' sh 'npm i -g pnpm'
}
}
stage('Install dependencies') {
steps {
sh 'pnpm i' sh 'pnpm i'
}
}
stage('Buid') {
steps {
sh 'pnpm build' sh 'pnpm build'
} }
} }
@ -24,6 +22,8 @@ agent {
steps { steps {
sh 'rm -rf /var/www/dev.araozu/*' sh 'rm -rf /var/www/dev.araozu/*'
sh 'mv -f dist/* /var/www/dev.araozu/' sh 'mv -f dist/* /var/www/dev.araozu/'
sh 'docker-compose down || true'
sh 'docker-compose up -d'
} }
} }
} }

23
docker-compose.yml Normal file
View File

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