Commit 6b1689ad authored by Christophe Benz's avatar Christophe Benz
Browse files

Use kaniko to build Docker image

parent 59594e9b
Pipeline #1646 failed with stage
in 1 minute and 43 seconds
image: git.opendatafrance.net:4567/observatoire/observatoire-scripts:latest
stages:
- build_docker_image
- docker
- build
- deploy
build_docker_image:
stage: build_docker_image
image: docker:stable
services:
- docker:18.09-dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
Build Docker image:
stage: docker
only:
changes:
- Dockerfile
tags:
- docker-privileged
- Dockerfile.ci
refs:
- master
variables:
# Do not build Docker image from scheduled jobs.
# Cf https://gitlab.com/gitlab-org/gitlab/issues/27318#note_215688359
- $CI_PIPELINE_SOURCE == "push"
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.ci --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
build:
Download and generate data:
stage: build
except:
- pushes
image: $CI_REGISTRY_IMAGE:latest
script:
- ./download_and_prepare_data
- ./process_and_generate
......@@ -37,13 +36,14 @@ build:
cache:
paths:
- cache/georef.db
except:
- pushes
tags:
- observatoire
update_observatoire_data_repo:
Update Observatoire data repo:
stage: deploy
except:
- pushes
image: $CI_REGISTRY_IMAGE:latest
before_script:
- date
- locale
......@@ -81,12 +81,14 @@ update_observatoire_data_repo:
environment:
name: production
url: https://git.opendatafrance.net/observatoire/observatoire-data/tree/master/sources
except:
- pushes
tags:
- observatoire
update-superset-db:
Update Superset DB:
stage: deploy
except:
- pushes
image: $CI_REGISTRY_IMAGE:latest
before_script:
# Run ssh-agent (inside the build environment).
- eval $(ssh-agent -s)
......@@ -102,7 +104,5 @@ update-superset-db:
environment:
name: production
url: https://lab.observatoire-opendata.fr/
except:
- pushes
tags:
- observatoire
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment