From 0ef04049d362462d9b33db3dbe289294173ca2a3 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Fri, 6 Sep 2019 12:13:36 +0100 Subject: [PATCH] Issue #2: add a Dockerfile and docker setup stage to CI --- .gitlab-ci.yml | 24 ++++++++++++++++++++++++ ci/docker/Dockerfile | 15 +++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 ci/docker/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c3a4555..a71057c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,31 @@ stages: + - setup - test +docker_build: + image: docker:18.09.0 + stage: setup + variable: + DOCKER_HOST: tcp://docker:2375/ + DOCKER_DRIVER: overlay2 + DOCKER_IMAGE_NAME_CI: ${CI_REGISTRY_IMAGE}/puma-ci:${CI_COMMIT_REF_SLUG} + services: + - docker:dind + script: + # Login to our registry + - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin ${CI_REGISTRY} + - cd ./ci/docker + - docker build --target PUMA_CI -t ${DOCKER_IMAGE_NAME_CI} . + - docker push ${DOCKER_IMAGE_NAME_CI} + tags: + - docker + - gce + only: + changes: + - ci/docker/**/* + .test_base_task: &test_base_task + image: registry.gitlab.com/gift-surg/puma/puma-ci:master script: - pytest diff --git a/ci/docker/Dockerfile b/ci/docker/Dockerfile new file mode 100644 index 0000000..f2277c6 --- /dev/null +++ b/ci/docker/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:18.04 AS PUMA_CI +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + tzdata \ + git-core \ + python3.7 \ + python3-distutils \ + curl \ + && rm -rf /var/lib/apt/lists/* +# Make python3.7 available via python +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py +RUN python get-pip.py +# Install needed tools +RUN pip install pytest