Tryiing to fix Jenkins.

This commit is contained in:
emil28092005
2026-01-18 05:23:17 +03:00
parent cce78fa8b3
commit bfe848f335
Vendored
+21 -15
View File
@@ -6,11 +6,12 @@ pipeline {
timestamps() timestamps()
} }
environment { environment {
IMAGE_NAME = "shagram" IMAGE_NAME = "shagram"
DEPLOY_DIR = "/opt/shagram/shagram/deploy/shagram" DEPLOY_DIR = "/opt/shagram/shagram/deploy/shagram"
COMPOSE_FILE = "/opt/shagram/shagram/deploy/shagram/compose.yaml" COMPOSE_FILE = "${WORKSPACE}/deploy/shagram/compose.yaml"
} }
stages { stages {
stage('Checkout') { stage('Checkout') {
@@ -46,16 +47,21 @@ pipeline {
} }
stage('Deploy') { stage('Deploy') {
steps { when {
sh ''' beforeAgent true
set -eux branch 'main'
mkdir -p "$DEPLOY_DIR" }
cat > "$DEPLOY_DIR/.env" <<EOF steps {
APP_IMAGE=$APP_IMAGE sh '''
EOF set -eux
docker compose -f "$COMPOSE_FILE" --project-directory "$DEPLOY_DIR" up -d --remove-orphans mkdir -p "$DEPLOY_DIR"
''' cat > "$DEPLOY_DIR/.env" <<EOF
} APP_IMAGE=$APP_IMAGE
EOF
docker compose -f "$COMPOSE_FILE" --project-directory "$DEPLOY_DIR" up -d --remove-orphans
'''
}
} }
} }
} }