98f56b5013
Signed-off-by: Frank Villaro-Dixon <frank.villaro@infomaniak.com>
47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
variables:
|
|
DOCKERFILE_LOCATION: '.'
|
|
DOCKERFILE_NAME: 'Dockerfile'
|
|
|
|
|
|
dockerfile_lint:
|
|
stage: .pre
|
|
image: hadolint/hadolint:latest-debian
|
|
|
|
allow_failure: true
|
|
before_script:
|
|
- 'cd $DOCKERFILE_LOCATION'
|
|
script:
|
|
- hadolint --ignore DL3008 --ignore DL3059 $DOCKERFILE_NAME
|
|
except:
|
|
- tags
|
|
- schedules
|
|
|
|
|
|
|
|
.docker_build:
|
|
stage: build
|
|
image:
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
entrypoint: [""]
|
|
variables:
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
before_script:
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
|
|
|
|
docker-build-commit:
|
|
extends: .docker_build
|
|
script: |
|
|
/kaniko/executor \
|
|
--force \
|
|
--cache=true \
|
|
--cache-copy-layers \
|
|
--cache-repo=$CI_REGISTRY \
|
|
--context "${CI_PROJECT_DIR}/${DOCKERFILE_LOCATION}" \
|
|
--dockerfile "${CI_PROJECT_DIR}/${DOCKERFILE_LOCATION}/${DOCKERFILE_NAME}" \
|
|
--destination "${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_NAME}:${CI_COMMIT_SHORT_SHA}" \
|
|
--destination "${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_NAME}:latest"
|
|
except:
|
|
- tags
|
|
- schedules
|
|
|