Commit 8fcba50c authored by Thijs Walcarius's avatar Thijs Walcarius

Add .gitlab-ci.yml to automatically build and push images

parent dc974474
.build-tag-push: &build-tag-push
image: docker:18-git
stage: build
only:
- pushes
services:
- docker:18-dind
before_script:
- apk add make bash
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE/$docker_image:latest || echo "No previous image build found for $docker_image"
- DARGS="$EXTRA_DARGS -t \"$CI_REGISTRY_IMAGE/$docker_image:$DOCKER_TAG\" -t \"$CI_REGISTRY_IMAGE/$docker_image:$CI_COMMIT_SHA\" -t \"$CI_REGISTRY_IMAGE/$docker_image:$CI_COMMIT_REF_SLUG\" --cache-from \"$CI_REGISTRY_IMAGE/$docker_image:latest\"" make "build/$docker_image" OWNER="$CI_REGISTRY_IMAGE"
- docker push $CI_REGISTRY_IMAGE/$docker_image:latest
- docker push $CI_REGISTRY_IMAGE/$docker_image:$DOCKER_TAG
- docker push $CI_REGISTRY_IMAGE/$docker_image:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE/$docker_image:$CI_COMMIT_SHA
.base-variables: &base-variables
DOCKER_TAG: cuda10.1-ubuntu18.04
DOCKER_DRIVER: overlay2
stages:
- update-from-upstream
- build-base-notebook
- build-minimal-notebook
- build-scipy-notebook
- build
update-from-upstream:
stage: update-from-upstream
only:
- schedules
- web
image: alpine:latest
before_script:
- apk add git openssh-client
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- echo "$GIT_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- git config --global user.email "ci.robot@ilabt.imec.be"
- git config --global user.name "Mr. Robot"
script:
- cd /tmp
- git clone git@gitlab.ilabt.imec.be:ilabt/gpu-docker-stacks.git
- cd gpu-docker-stacks
- git remote add upstream https://github.com/jupyter/docker-stacks.git || git remote -v
- git fetch upstream
- git branch -tf upstream_master upstream/master
- git checkout master
- git rebase upstream_master
- git push --force origin master
cache: {}
build-base-notebook:
<<: *build-tag-push
stage: build-base-notebook
variables:
<<: *base-variables
docker_image: base-notebook
BASE_CONTAINER: nvcr.io/nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04
EXTRA_DARGS: "--build-arg BASE_CONTAINER=\"$BASE_CONTAINER\" "
build-minimal-notebook:
<<: *build-tag-push
stage: build-minimal-notebook
variables:
<<: *base-variables
docker_image: minimal-notebook
EXTRA_DARGS: "--build-arg BASE_CONTAINER=\"$CI_REGISTRY_IMAGE/base-notebook:latest\" "
build-scipy-notebook:
<<: *build-tag-push
stage: build-scipy-notebook
variables:
<<: *base-variables
docker_image: scipy-notebook
EXTRA_DARGS: "--build-arg BASE_CONTAINER=\"$CI_REGISTRY_IMAGE/minimal-notebook:latest\" "
build:tensorflow-notebook:
<<: *build-tag-push
stage: build
variables:
<<: *base-variables
docker_image: tensorflow-notebook
EXTRA_DARGS: "--build-arg BASE_CONTAINER=\"$CI_REGISTRY_IMAGE/scipy-notebook:latest\" "
build:datascience-notebook:
<<: *build-tag-push
stage: build
variables:
<<: *base-variables
docker_image: datascience-notebook
EXTRA_DARGS: "--build-arg BASE_CONTAINER=\"$CI_REGISTRY_IMAGE/scipy-notebook:latest\" "
......@@ -2,6 +2,7 @@
# Distributed under the terms of the Modified BSD License.
# Ubuntu 18.04 (bionic)
# This comment is edited to create a merge conflict once the base container is changed upstream
# https://hub.docker.com/_/ubuntu/?tab=tags&name=bionic
# OS/ARCH: linux/amd64
ARG ROOT_CONTAINER=ubuntu:bionic-20200219@sha256:0925d086715714114c1988f7c947db94064fd385e171a63c07730f1fa014e6f9
......
......@@ -7,6 +7,6 @@ LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
# Install Tensorflow
RUN pip install --quiet \
'tensorflow==2.1.0' && \
'tensorflow-gpu==2.1.0' && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
Markdown is supported
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