Skip to content
Snippets Groups Projects
Commit a984fae7 authored by Benjamin Ledel's avatar Benjamin Ledel
Browse files

Update file .gitlab-ci.yml

parent 637ec12a
No related branches found
No related tags found
No related merge requests found
Pipeline #1574998 failed
...@@ -8,6 +8,9 @@ scheduler-docker-build: ...@@ -8,6 +8,9 @@ scheduler-docker-build:
# Use the official docker image. # Use the official docker image.
image: docker:latest image: docker:latest
stage: build stage: build
only:
- main
- tags
variables: variables:
DOCKER_HOST: tcp://docker:2375 DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
...@@ -19,18 +22,23 @@ scheduler-docker-build: ...@@ -19,18 +22,23 @@ scheduler-docker-build:
# Default branch leaves tag empty (= latest tag) # Default branch leaves tag empty (= latest tag)
# All other branches are tagged with the escaped branch name (commit ref slug) # All other branches are tagged with the escaped branch name (commit ref slug)
script: script:
- | - |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag="" tag="latest"
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else elif [[ -n "$CI_COMMIT_TAG" ]]; then
tag=":$CI_COMMIT_REF_SLUG" tag="$CI_COMMIT_TAG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" echo "Running on tag '$CI_COMMIT_TAG': tag = $tag"
fi else
# Build frontend Docker Container tag="$CI_COMMIT_REF_SLUG"
- mv ./scheduler/.production.env ./scheduler/.env echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}/scheduler" ./scheduler fi
- docker push "$CI_REGISTRY_IMAGE${tag}/scheduler" image_name="$CI_REGISTRY_IMAGE/scheduler:$tag"
echo "Docker image name is: $image_name"
- mv ./scheduler/.production.env ./scheduler/.env
- docker build --pull -t "$image_name" ./src
- docker push "$image_name"
deploy: deploy:
stage: deploy stage: deploy
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment