This commit is contained in:
2022-09-06 15:11:35 +07:00
parent a3ace3a444
commit 2d0c627dc9
4 changed files with 92 additions and 0 deletions

43
ci/.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,43 @@
# полный реферерс тут
# https://docs.gitlab.com/ee/ci/yaml/index.html
# а тут доступные переменные
# https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
image: docker:20.10.16
variables:
REGISTRY: hub.bildme.ru
IMAGE_NAME: $REGISTRY/$CI_PROJECT_PATH:latest
stages:
- build
# - deploy
build_main:
stage: build
variables:
DOCKER_BASEIMAGE: golang:latest
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $REGISTRY
script:
- docker build --pull --build-arg DOCKER_BASEIMAGE=${DOCKER_BASEIMAGE} -t $IMAGE_NAME .
- docker push $IMAGE_NAME
tags:
- docker
# deploy_prod:
# image: hub.realmanual.ru/pub/openssh-client:latest
# stage: deploy
# variables:
# DOCKER_SERVER: 192.168.9.199
# before_script:
# - eval $(ssh-agent -s)
# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
# - mkdir -p ~/.ssh
# - chmod 700 ~/.ssh
# - ssh-keyscan ${DOCKER_SERVER} >> ~/.ssh/known_hosts
# - chmod 644 ~/.ssh/known_hosts
# script:
# - ssh root@${DOCKER_SERVER} "docker rm -f main-go; docker pull hub.bildme.ru/firstgroup/go-site && docker run --rm --name main-go -p 3000:3000 hub.bildme.ru/firstgroup/go-site:latest"
# tags:
# - docker