Update GitLab CI/CD pipeline

This commit is contained in:
2025-06-07 09:56:23 +02:00
parent bdf596a916
commit a305fd3b6e
3 changed files with 56 additions and 12 deletions

View File

@@ -1,3 +1,18 @@
.build-next-template:
stage: build
image: node:22@sha256:f6b9c31ace05502dd98ef777aaa20464362435dcc5e312b0e213121dcf7d8b95
script:
- |
cd $WORKDIR_PATH
npm ci
npm run build
artifacts:
paths:
- $WORKDIR_PATH/.next
- $WORKDIR_PATH/public
- $WORKDIR_PATH/package.json
- $WORKDIR_PATH/package-lock.json
.docker-login: .docker-login:
before_script: before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin - echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin

View File

@@ -1,28 +1,40 @@
image: docker:20.10 image: docker:20.10@sha256:2967f0819c84dd589ed0a023b9d25dcfe7a3c123d5bf784ffbb77edf55335f0c
include: include:
- local: '.gitlab-ci-template.yml' - local: '.gitlab-ci-template.yml'
- local: 'lawfirm-demos/.gitlab-ci.yml'
stages: stages:
- build
- dockerize - dockerize
variables: variables:
CI_REGISTRY_IMAGE: $CI_REGISTRY/$CI_PROJECT_PATH CI_REGISTRY_IMAGE: $CI_REGISTRY/$CI_PROJECT_PATH
PROJECT_NAME: $CI_PROJECT_NAME PROJECT_NAME: $CI_PROJECT_NAME
TAG: $CI_COMMIT_REF_SLUG TAG: $CI_COMMIT_REF_SLUG
NEXT_PUBLIC_ENV: "production"
# Main Website cache:
build_main_website: key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .next/cache/
# Main Website - Build
build_main:
stage: build
extends: .build-next-template
variables:
WORKDIR_PATH: main-website
# Main Website - Dockerize
dockerize_main:
stage: dockerize stage: dockerize
extends: .docker-build-template extends: .docker-build-template
variables: variables:
IMAGE_NAME: main-website IMAGE_NAME: main-website
WORKDIR_PATH: ./main-website WORKDIR_PATH: main-website
DOCKERFILE_PATH: Dockerfile
# Demo 1 needs:
build_demo_1: - job: build_main
stage: dockerize artifacts: true
extends: .docker-build-template
variables:
IMAGE_NAME: ld1
WORKDIR_PATH: ./lawfirm-demos/demo-1

View File

@@ -0,0 +1,17 @@
build_demo_1:
stage: build
extends: .build-next-template
variables:
IMAGE_NAME: ld1
WORKDIR_PATH: ./lawfirm-demos/demo-1
dockerize_demo_1:
stage: dockerize
extends: .docker-build-template
variables:
IMAGE_NAME: ld1
WORKDIR_PATH: ./lawfirm-demos/demo-1
DOCKERFILE_PATH: Dockerfile
needs:
- job: build_demo_1
artifacts: true