mirror of
https://github.com/elyby/accounts.git
synced 2024-12-02 11:41:05 +05:30
Define VERSION env variable as a step
This commit is contained in:
parent
80b99db0f8
commit
d333798919
@ -4,8 +4,12 @@ stages:
|
|||||||
- release
|
- release
|
||||||
- cleanup
|
- cleanup
|
||||||
|
|
||||||
|
.defineVersion: &defineVersion |-
|
||||||
|
export VERSION="${CI_COMMIT_TAG:-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}}"
|
||||||
|
.loginIntoRegistry: &loginIntoRegistry |-
|
||||||
|
docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
VERSION: "${CI_COMMIT_TAG:-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}}"
|
|
||||||
APP_IMAGE_NAME: "registry.ely.by/elyby/accounts"
|
APP_IMAGE_NAME: "registry.ely.by/elyby/accounts"
|
||||||
WEB_IMAGE_NAME: "registry.ely.by/elyby/accounts-nginx"
|
WEB_IMAGE_NAME: "registry.ely.by/elyby/accounts-nginx"
|
||||||
DB_IMAGE_NAME: "registry.ely.by/elyby/accounts-mariadb"
|
DB_IMAGE_NAME: "registry.ely.by/elyby/accounts-mariadb"
|
||||||
@ -59,9 +63,13 @@ build:production:
|
|||||||
image: docker:18.02
|
image: docker:18.02
|
||||||
stage: build
|
stage: build
|
||||||
before_script:
|
before_script:
|
||||||
|
- *defineVersion
|
||||||
|
- *loginIntoRegistry
|
||||||
- sed -i -e "s/{{PLACE_VERSION_HERE}}/$VERSION/g" common/config/config.php
|
- sed -i -e "s/{{PLACE_VERSION_HERE}}/$VERSION/g" common/config/config.php
|
||||||
- docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
|
||||||
script:
|
script:
|
||||||
|
- docker pull "$APP_IMAGE_NAME:latest"
|
||||||
|
- docker pull "$WEB_IMAGE_NAME:latest"
|
||||||
|
- docker pull "$DB_IMAGE_NAME:latest"
|
||||||
- >
|
- >
|
||||||
docker build
|
docker build
|
||||||
--pull
|
--pull
|
||||||
@ -93,7 +101,7 @@ release:latest:
|
|||||||
variables:
|
variables:
|
||||||
GIT_STRATEGY: none
|
GIT_STRATEGY: none
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
- *loginIntoRegistry
|
||||||
script:
|
script:
|
||||||
- docker tag "$APP_IMAGE_NAME:$CI_PIPELINE_ID" "$APP_IMAGE_NAME:latest"
|
- docker tag "$APP_IMAGE_NAME:$CI_PIPELINE_ID" "$APP_IMAGE_NAME:latest"
|
||||||
- docker push "$APP_IMAGE_NAME:latest"
|
- docker push "$APP_IMAGE_NAME:latest"
|
||||||
@ -113,7 +121,7 @@ release:tag:
|
|||||||
variables:
|
variables:
|
||||||
GIT_STRATEGY: none
|
GIT_STRATEGY: none
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
- *loginIntoRegistry
|
||||||
script:
|
script:
|
||||||
- docker tag "$APP_IMAGE_NAME:$CI_PIPELINE_ID" "$APP_IMAGE_NAME:$VERSION"
|
- docker tag "$APP_IMAGE_NAME:$CI_PIPELINE_ID" "$APP_IMAGE_NAME:$VERSION"
|
||||||
- docker push "$APP_IMAGE_NAME:$VERSION"
|
- docker push "$APP_IMAGE_NAME:$VERSION"
|
||||||
|
Loading…
Reference in New Issue
Block a user