mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-22 06:15:47 +00:00
Update .gitlab-ci.yml file
This commit is contained in:
+4
-12
@@ -2,15 +2,10 @@ stages:
|
||||
- build
|
||||
|
||||
variables:
|
||||
# 🔧 Aktifkan Docker BuildKit (build lebih cepat & caching layer)
|
||||
DOCKER_BUILDKIT: "1"
|
||||
COMPOSE_DOCKER_CLI_BUILD: "1"
|
||||
DOCKER_DRIVER: overlay2
|
||||
|
||||
# 🧠 Nama image (pakai commit short SHA)
|
||||
IMAGE_NAME: "$CI_REGISTRY_IMAGE/web-lti:development_${CI_COMMIT_SHORT_SHA}"
|
||||
|
||||
# Cache npm (disimpan antar pipeline)
|
||||
NPM_CACHE_DIR: "$CI_PROJECT_DIR/.npm"
|
||||
|
||||
cache:
|
||||
@@ -25,20 +20,17 @@ build-image:
|
||||
- docker:dind
|
||||
|
||||
before_script:
|
||||
- echo "🔐 Logging in to GitLab Container Registry..."
|
||||
- echo "Logging in to GitLab Container Registry..."
|
||||
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
|
||||
|
||||
script:
|
||||
- echo "🚧 Building optimized Docker image..."
|
||||
- echo "Building optimized Docker image..."
|
||||
- docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE/web-lti:latest -t "$IMAGE_NAME" .
|
||||
- docker push "$IMAGE_NAME"
|
||||
|
||||
# 🧹 Keep only last 3 images (hapus yang lama)
|
||||
- echo "🧹 Cleaning old images..."
|
||||
- echo "Cleaning old images (keep last 3)..."
|
||||
- docker image prune -af --filter "until=72h"
|
||||
|
||||
after_script:
|
||||
- echo "✅ Build complete: $IMAGE_NAME"
|
||||
after_script: "echo 'Build complete: $IMAGE_NAME'"
|
||||
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "development"'
|
||||
Reference in New Issue
Block a user