aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gitlab-ci-template-nocache.yml45
1 files changed, 45 insertions, 0 deletions
diff --git a/gitlab-ci-template-nocache.yml b/gitlab-ci-template-nocache.yml
new file mode 100644
index 0000000..e5b8cae
--- /dev/null
+++ b/gitlab-ci-template-nocache.yml
@@ -0,0 +1,45 @@
+# https://blog.callr.tech/building-docker-images-with-gitlab-ci-best-practices/
+# comments dropped, updated for podman builds
+# this variant builds without caching
+
+image: registry.gitlab.com/kraxel/podman-docker-builder:latest
+
+stages:
+ - build
+ - push
+
+before_script:
+ - podman login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
+
+Build:
+ stage: build
+ script:
+ - >
+ podman build
+ --build-arg VCS_REF=$CI_COMMIT_SHA
+ --build-arg VCS_URL=$CI_PROJECT_URL
+ --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+ .
+ - podman push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+
+Push latest:
+ variables:
+ GIT_STRATEGY: none
+ stage: push
+ only:
+ - master
+ script:
+ - podman pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+ - podman tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
+ - podman push $CI_REGISTRY_IMAGE:latest
+
+Push tag:
+ variables:
+ GIT_STRATEGY: none
+ stage: push
+ only:
+ - tags
+ script:
+ - podman pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
+ - podman tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
+ - podman push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME