Skip to content
Snippets Groups Projects
Commit 8decd4f3 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

build both dockerfile

parent b0d74c6b
No related branches found
No related tags found
No related merge requests found
Pipeline #101819 failed
......@@ -10,20 +10,24 @@ build:
script:
- docker --version
# pull the latest build on master
- docker pull "$CI_REGISTRY_IMAGE/master:latest" || true
- docker pull "$CI_REGISTRY_IMAGE/master/$DOCKERFILE_NAME:latest" || true
# pull the latest build on this branch
- docker pull "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:latest" || true
- docker pull "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/$DOCKERFILE_NAME:latest" || true
# build the image while passing commit SHA and tagging the image with it
- docker build
--build-arg CI_COMMIT_REF_SLUG
--build-arg CI_COMMIT_SHA
--cache-from "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:latest"
--cache-from "$CI_REGISTRY_IMAGE/master:latest"
--tag "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA"
--tag "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:latest"
-f Dockerfile2
--cache-from "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/$DOCKERFILE_NAME:latest"
--cache-from "$CI_REGISTRY_IMAGE/master/$DOCKERFILE_NAME:latest"
--tag "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/$DOCKERFILE_NAME:$CI_COMMIT_SHA"
--tag "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/$DOCKERFILE_NAME:latest"
-f $DOCKERFILE_NAME
./
# push image as latest for the current branch
- docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:latest"
# push image tagged with its sha
- docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA"
parallel:
matrix:
- DOCKERFILE_NAME: [Dockerfile, Dockerfile2]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment