Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.07 KiB
Newer Older
include:
  - remote: https://open.greenhost.net/stackspin/stackspin/-/raw/main/.gitlab/ci_templates/helm_package.yml
  - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'

stages:
  - build-project
  - build-container
  - lint-helm-chart
  - package-helm-chart
  - release-helm-chart
image: node:18-alpine
Maarten de Waard's avatar
Maarten de Waard committed

variables:
  CHART_NAME: stackspin-dashboard
  CHART_DIR: deployment/helmchart/

build-project:
  stage: build-project
  before_script: []
  script:
    - cd frontend
    - echo "Building app"
    - yarn install
Maarten de Waard's avatar
Maarten de Waard committed
    - echo "REACT_APP_API_URL=/api/v1" > .env
    - echo "EXTEND_ESLINT=true" >> .env
    - yarn build
    - mv build web-build
    - echo "Build successful"
  artifacts:
    expire_in: 1 hour
    name: web-build
    paths:
      - frontend/web-build
.kaniko-build:
  script:
    - cd ${DIRECTORY}
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - export CONTAINER_TAG=${CI_COMMIT_TAG:-${CI_COMMIT_REF_SLUG}}
    - /kaniko/executor --cache=true --context ${CI_PROJECT_DIR}/${DIRECTORY} --destination ${CI_REGISTRY_IMAGE}/${KANIKO_BUILD_IMAGENAME}:${CONTAINER_TAG}

build-frontend-container:
  stage: build-container
  image:
    # We need a shell to provide the registry credentials, so we need to use the
    # kaniko debug image (https://github.com/GoogleContainerTools/kaniko#debug-image)
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
    DIRECTORY: frontend/web-build
  before_script:
    - cp deployment/Dockerfile $DIRECTORY
    - cp deployment/nginx.conf $DIRECTORY
  extends:
    .kaniko-build

build-backend-container:
  stage: build-container
  variables:
    KANIKO_BUILD_IMAGENAME: dashboard-backend
    DIRECTORY: backend
  image:
    # We need a shell to provide the registry credentials, so we need to use the
    # kaniko debug image (https://github.com/GoogleContainerTools/kaniko#debug-image)
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  extends:
    .kaniko-build