summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorJonas Zohren <git-pbkyr@jzohren.de>2021-07-19 17:18:25 +0200
committerJonas Zohren <git-pbkyr@jzohren.de>2021-07-19 20:39:58 +0200
commit678ce0abc6932630fb97409d9ef7aeaff6b97d80 (patch)
tree718f244191cfafb4859334bf588cff61ae4b8908 /.gitlab-ci.yml
parent59d538206f80fec19867c059824d83efe63d8b76 (diff)
downloadconduit-678ce0abc6932630fb97409d9ef7aeaff6b97d80.zip
CI: Create docker image with musl binary
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml41
1 files changed, 41 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0924ee3..60b8833 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,6 @@
stages:
- build
+ - build docker image
- test
- upload artifacts
@@ -212,6 +213,46 @@ build:cargo-deb:x86_64-unknown-linux-gnu:
+# --------------------------------------------------------------------- #
+# Create and publish docker image #
+# --------------------------------------------------------------------- #
+
+.docker-shared-settings:
+ stage: "build docker image"
+ needs: []
+ interruptible: true
+ image:
+ name: "gcr.io/kaniko-project/executor:debug"
+ entrypoint: [""]
+ tags: ["docker"]
+ variables:
+ # Configure Kaniko Caching: https://cloud.google.com/build/docs/kaniko-cache
+ KANIKO_CACHE_ARGS: "--cache=true --cache-copy-layers=true --cache-ttl=120h --cache-repo $CI_REGISTRY_IMAGE/kaniko-ci-cache"
+ before_script:
+ - "mkdir -p /kaniko/.docker"
+ - 'echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json'
+
+
+# Build a docker image by packaging up the x86_64-unknown-linux-musl binary into an alpine image
+build:docker:main:
+ extends: .docker-shared-settings
+ needs:
+ - "build:cargo:x86_64-unknown-linux-musl"
+ script:
+ - >
+ /kaniko/executor
+ $KANIKO_CACHE_ARGS
+ --context $CI_PROJECT_DIR
+ --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
+ --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)
+ --build-arg "GIT_REF=$CI_COMMIT_REF_NAME"
+ --dockerfile "$CI_PROJECT_DIR/docker/ci-binaries-packaging.Dockerfile"
+ --destination "$CI_REGISTRY_IMAGE/conduit:latest"
+ --destination "$CI_REGISTRY_IMAGE/conduit:alpine"
+ --destination "$CI_REGISTRY_IMAGE/conduit:commit-$CI_COMMIT_SHORT_SHA"
+ rules:
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+
# --------------------------------------------------------------------- #
# Store binaries as package so they have download urls #