Forked from
KSZK / DevTeam / kszkepzes / old / kszkepzes-frontend
82 commits behind the upstream repository.
-
Torma Kristóf authoredTorma Kristóf authored
.gitlab-ci.yml 1.27 KiB
variables:
CONTAINER_IMAGE: 'registry.kszk.bme.hu/kszk/devteam/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME'
stages:
- Pre Build
- Docker Build
- deploy
PreBuild:
stage: Pre Build
tags: [docker]
image: node:latest
script:
- npm install
- npm run build
cache:
paths:
- build/
artifacts:
expire_in: 1 day
paths:
- build/
only:
- tags
Docker build:
stage: Docker Build
tags: [docker]
only:
- tags
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: ['']
script:
- echo "{\"auths\":{\"registry.kszk.bme.hu\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CONTAINER_IMAGE
Deploy to Kubernetes:
stage: deploy
image: alpine
environment:
name: master
script:
- apk add --no-cache curl
- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- chmod +x ./kubectl
- mv ./kubectl /usr/local/bin/kubectl
- kubectl version
- cd contrib/kubernetes/
- sed -i "s|##IMAGETAG##|${CI_COMMIT_REF_NAME}|" *.yaml
- kubectl apply -f deployment.yaml
only:
- tags