Tryiing to fix Jenkins.
This commit is contained in:
Vendored
+9
-3
@@ -9,9 +9,10 @@ pipeline {
|
|||||||
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') {
|
||||||
steps {
|
steps {
|
||||||
@@ -46,16 +47,21 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
branch 'main'
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
set -eux
|
set -eux
|
||||||
mkdir -p "$DEPLOY_DIR"
|
mkdir -p "$DEPLOY_DIR"
|
||||||
cat > "$DEPLOY_DIR/.env" <<EOF
|
cat > "$DEPLOY_DIR/.env" <<EOF
|
||||||
APP_IMAGE=$APP_IMAGE
|
APP_IMAGE=$APP_IMAGE
|
||||||
EOF
|
EOF
|
||||||
docker compose -f "$COMPOSE_FILE" --project-directory "$DEPLOY_DIR" up -d --remove-orphans
|
docker compose -f "$COMPOSE_FILE" --project-directory "$DEPLOY_DIR" up -d --remove-orphans
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user