From 2d7180335a93179d8004afc62a2299af508dd3e0 Mon Sep 17 00:00:00 2001 From: Winston Smith Date: Tue, 20 Jul 2021 16:28:05 +0200 Subject: [PATCH] Feat: Add Gitlab CI/CD conf --- .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..73ee955 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,34 @@ +# To contribute improvements to CI/CD templates, please follow the Development guide at: +# https://docs.gitlab.com/ee/development/cicd/templates.html +# This specific template is located at: +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml + +# Build a Docker image with CI/CD and push to the GitLab registry. +# Docker-in-Docker documentation: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html +# +# This template uses one generic job with conditional builds +# for the default branch and all other (MR) branches. + +image: docker:latest +services: + - docker:dind +.build_template: + stage: build + variables: + IMAGE: "${NEXUS_URL}/docusaurus-${CI_ENVIRONMENT_NAME}:latest" + before_script: + - docker --version + - echo "${IMAGE}" + - docker login "${NEXUS_URL}" --username "${NEXUS_USER}" --password "${NEXUS_PASSWORD}" + - echo $(docker pull "${IMAGE}") + script: + - docker build . -t "docusaurus-${CI_ENVIRONMENT_NAME}:latest" + - docker tag "docusaurus-${CI_ENVIRONMENT_NAME}:latest" "${IMAGE}" + - docker push "${IMAGE}" + +build_preproduction: + extends: .build_template + environment: + name: preproduction + only: + - preproduction