build and deploy with gitlab-ci
This commit is contained in:
parent
1828a51b75
commit
8370bc0251
1 changed files with 35 additions and 0 deletions
35
.gitlab-ci.yml
Normal file
35
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
image: docker:git
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
|
||||||
|
variables:
|
||||||
|
TEST_IMAGE: registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:$CI_BUILD_REF_NAME
|
||||||
|
RELEASE_IMAGE: registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:latest
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
|
||||||
|
|
||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- docker build -t $TEST_IMAGE .
|
||||||
|
- docker push $TEST_IMAGE
|
||||||
|
|
||||||
|
test:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- docker run $TEST_IMAGE
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
script:
|
||||||
|
- docker pull $TEST_IMAGE
|
||||||
|
- docker tag $TEST_IMAGE $RELEASE_IMAGE
|
||||||
|
- docker push $RELEASE_IMAGE
|
||||||
|
only:
|
||||||
|
- master
|
Loading…
Add table
Reference in a new issue