1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-22 08:12:27 +00:00

Added gitlab-ci docker build jobs

This commit is contained in:
J. Fernando Sánchez 2017-02-13 19:41:18 +01:00
parent 068241fb72
commit 528bbcac35

View File

@ -5,13 +5,15 @@ image: docker:latest
# improved performance. # improved performance.
variables: variables:
DOCKER_DRIVER: overlay DOCKER_DRIVER: overlay
IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_BUILD_TAG
DOCKERFILE: Dockerfile DOCKERFILE: Dockerfile
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
stages: stages:
- test - test
- images
- release - release
- deploy
.test: &test_definition .test: &test_definition
variables: variables:
@ -21,7 +23,7 @@ stages:
- .venv/ - .venv/
- pip-cache/ - pip-cache/
key: "$CI_PROJECT_NAME" key: "$CI_PROJECT_NAME"
stage: deploy stage: test
script: script:
- pip install virtualenv - pip install virtualenv
- virtualenv -q .venv - virtualenv -q .venv
@ -40,30 +42,35 @@ test-2.7:
<<: *test_definition <<: *test_definition
image: "python:2.7" image: "python:2.7"
.image: &image_definition
stage: release
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script:
- docker build -f $DOCKERFILE . -t $IMAGE_NAME
- docker push $IMAGE_NAME
# only:
# - tags
# - triggers
image-master: .image: &image_definition
<<: *image_definition variables:
PYTHON_VERSION: "3.5"
script:
- docker build -f Dockerfile-3.5 . -t $CI_REGISTRY_IMAGE:$CI_BUILD_TAG-$PYTHON_VERSION
- docker push $CI_REGISTRY_IMAGE:$CI_BUILD_TAG-$PYTHON_VERSION
stage: images
only: only:
- master - tags
- triggers
image-3.5: image-3.5:
<<: *image_definition <<: *image_definition
variables: variables:
IMAGE_NAME: "$REGISTRY_IMAGE:$CI_BUILD_TAG-python3.5" PYTHON_VERSION: "3.5"
DOCKERFILE: Dockerfile-3.5
image-2.7: image-2.7:
<<: *image_definition <<: *image_definition
variables: variables:
IMAGE_NAME: "$REGISTRY_IMAGE:$CI_BUILD_TAG-python2.7" PYTHON_VERSION: "2.7"
DOCKERFILE: Dockerfile-2.7
image-latest:
stage: release
script:
- docker build -f Dockerfile . -t $CI_REGISTRY_IMAGE
- docker tag $CI_REGISTRY_IMAGE $CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG
- docker push $IMAGE_NAME
- docker push $IMAGE_NAME:$CI_BUILD_REF_SLUG
only:
- master
- triggers