CI: Create docker image with musl binary
This commit is contained in:
parent
59d538206f
commit
678ce0abc6
2 changed files with 114 additions and 0 deletions
|
@ -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 #
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue