From c438618c9a9a95f3781a1d52c438a018d42f4ddb Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 23 Oct 2021 19:39:34 +0300 Subject: [PATCH] Add templates for Containerfiles style repos. --- templates/containerfiles.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 templates/containerfiles.yml diff --git a/templates/containerfiles.yml b/templates/containerfiles.yml new file mode 100644 index 0000000..fe42c0f --- /dev/null +++ b/templates/containerfiles.yml @@ -0,0 +1,27 @@ +--- +.container-build: + stage: build + variables: + DOCKER_BUILDKIT: "1" + tags: &tags [ns4.shore.co.il] + script: + - docker build --pull --no-cache --iidfile iid "$CONTEXT" + after_script: + - echo "HASH=$(cat iid)" > dot.env + artifacts: + reports: + dotenv: dot.env + rules: &rules + - if: $CI_PIPELINE_SOURCE == "schedule" + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - $CONTEXT/* + - $CONTEXT/**/* + +.container-push: + stage: deploy + tags: *tags + script: + - docker tag "$HASH" "registry.shore.co.il/$IMAGE:${TAG:-latest}" + - docker push "registry.shore.co.il/$IMAGE:${TAG:-latest}" + rules: *rules -- GitLab