35 lines
703 B
YAML
35 lines
703 B
YAML
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:
|
|
- echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin 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
|