From f83fe07553a20bda80070066b541073d049ab364 Mon Sep 17 00:00:00 2001 From: Dongho Kim Date: Sun, 7 Jun 2026 00:34:52 +0200 Subject: [PATCH] update --- Jenkinsfile | 39 +++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 22 ++++++++++++++++++++-- 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e1a8bcc --- /dev/null +++ b/Jenkinsfile @@ -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() + } + } +} diff --git a/docker-compose.yml b/docker-compose.yml index e60b8df..7f2d677 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: worldcup-app: build: @@ -11,3 +9,23 @@ services: restart: unless-stopped environment: - 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 \ No newline at end of file