From 13fd652d1f791a4ba94f5b5886cb8ca173e3efab Mon Sep 17 00:00:00 2001 From: chloe Date: Fri, 20 Mar 2026 19:38:23 +0000 Subject: [PATCH] update jenkinsfile --- Jenkinsfile | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a56fe72..e836809 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -60,26 +60,17 @@ pipeline { if [ -f .env ]; then cp .env /tmp/.seasoned_env_bak; fi - # Clone or pull the repo (contains docker-compose.yml) - if [ -d .git ]; then - git fetch origin - git reset --hard origin/${env.DEPLOY_BRANCH} - else - git clone ${env.GIT_REPO_URL} . - fi - + git fetch origin + git reset --hard origin/${env.DEPLOY_BRANCH} + if [ -f /tmp/.seasoned_env_bak ]; then mv /tmp/.seasoned_env_bak .env; fi - - if [ ! -f .env ]; then echo "WARNING: .env file is missing on server!"; fi - - # Set the image tag for this deployment + export IMAGE_TAG=${env.IMAGE_TAG} export DOCKER_REGISTRY=${env.DOCKER_REGISTRY} export DOCKER_IMAGE=${env.DOCKER_IMAGE} - - # Pull latest image and deploy - docker compose pull - docker compose up -d + + docker compose --env-file .env pull + docker compose --env-file .env up -d --force-recreate DEPLOY_EOF """ }