Feat: Add Gitlab CI/CD conf

This commit is contained in:
Winston Smith 2021-07-20 16:28:05 +02:00
parent 413ee10ccb
commit 2d7180335a

34
.gitlab-ci.yml Normal file
View File

@ -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