This commit is contained in:
Vendored
+39
@@ -0,0 +1,39 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'dongho' // Runs the deployment on the 'dongho' agent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
// Prepend common docker install paths to the environment PATH
|
||||||
|
PATH = "/usr/local/bin:/usr/bin:/bin:${env.PATH}"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
// Diagnostics to check if group_add is active
|
||||||
|
sh 'whoami && id && ls -lh /var/run/docker.sock || true'
|
||||||
|
|
||||||
|
// Pulls the latest changes from the Git repository
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build & Deploy') {
|
||||||
|
steps {
|
||||||
|
echo 'Building Docker image and starting service...'
|
||||||
|
// Build the image and recreate container with minimal downtime
|
||||||
|
sh 'docker compose up -d --build --remove-orphans'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
// Clean up the temporary Jenkins workspace since the files are baked into the image
|
||||||
|
cleanWs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
-2
@@ -1,5 +1,3 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
worldcup-app:
|
worldcup-app:
|
||||||
build:
|
build:
|
||||||
@@ -11,3 +9,23 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
labels:
|
||||||
|
- traefik.enable=true
|
||||||
|
- traefik.docker.network=proxy
|
||||||
|
- traefik.http.routers.worldcup26.entrypoints=http
|
||||||
|
- traefik.http.routers.worldcup26.rule=Host(`worldcup26.dongho.kim`)
|
||||||
|
- traefik.http.middlewares.worldcup26-redirect.redirectscheme.permanent=true
|
||||||
|
- traefik.http.middlewares.worldcup26-redirect.redirectscheme.scheme=https
|
||||||
|
- traefik.http.routers.worldcup26.middlewares=worldcup26-redirect
|
||||||
|
- traefik.http.routers.worldcup26-secure.entrypoints=https
|
||||||
|
- traefik.http.routers.worldcup26-secure.rule=Host(`worldcup26.dongho.kim`)
|
||||||
|
- traefik.http.routers.worldcup26-secure.tls=true
|
||||||
|
- traefik.http.routers.worldcup26-secure.tls.certresolver=cloudflare
|
||||||
|
- traefik.http.services.worldcup26-secure-service.loadbalancer.server.port=80
|
||||||
|
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
Reference in New Issue
Block a user