From e40bee618eba81f6f4fc54d469ab6c620be696bc Mon Sep 17 00:00:00 2001
From: Amandine PERRIN <amandine.perrin@pasteur.fr>
Date: Wed, 10 May 2017 14:35:21 +0200
Subject: [PATCH] Construct 3 docker images: 1 which will be used for tests, 2
 which will be used by installation script

- the test image contains all dependencies needed to run the pipeline (except the pipeline itself)
- the install-ubuntu-base image contains only ubuntu, with python3 and pip3 installed. This will be used to check that, in that case, the installation script installs everything
- the install-ubuntu-barrnapOnly contains ubuntu with Python3 and pip3 installed, and barrnap installed, but not prokka. The installation script should install prokka
---
 .gitlab-ci.yml                     | 24 ++++++++++++++++++++++--
 for_build/barrnap_only/Dockerfile  | 23 +++++++++++++++++++++++
 for_build/basics/Dockerfile        | 13 +++++++++++++
 Dockerfile => for_tests/Dockerfile |  0
 4 files changed, 58 insertions(+), 2 deletions(-)
 create mode 100644 for_build/barrnap_only/Dockerfile
 create mode 100644 for_build/basics/Dockerfile
 rename Dockerfile => for_tests/Dockerfile (100%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index db222d76..163ba757 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,12 +9,32 @@ variables:
 before_script:
   - docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" registry-gitlab.pasteur.fr
 
-build:
+build-test-image:
   only:
     - docker
   stage: build
   script:
     - apk update ; apk add git
     - git checkout master -- pythoncode/requirements.txt
-    - docker build --pull -t "$CI_REGISTRY_IMAGE:testing-ubuntu" .
+    - docker build --pull -t "$CI_REGISTRY_IMAGE:testing-ubuntu" for_tests
     - docker push "$CI_REGISTRY_IMAGE:testing-ubuntu"
+
+build-install-base:
+  only:
+    - docker
+  stage: build
+  script:
+    - apk update ; apk add git
+    - git checkout master -- pythoncode/requirements.txt
+    - docker build --pull -t "$CI_REGISTRY_IMAGE:install-ubuntu-base" for_build/basics
+    - docker push "$CI_REGISTRY_IMAGE:install-ubuntu-base"
+
+build-install-barrnap:
+  only:
+    - docker
+  stage: build
+  script:
+    - apk update ; apk add git
+    - git checkout master -- pythoncode/requirements.txt
+    - docker build --pull -t "$CI_REGISTRY_IMAGE:install-ubuntu-barrnapOnly" for_build/barrnap_only
+    - docker push "$CI_REGISTRY_IMAGE:install-ubuntu-barrnapOnly"
diff --git a/for_build/barrnap_only/Dockerfile b/for_build/barrnap_only/Dockerfile
new file mode 100644
index 00000000..0a02ca2b
--- /dev/null
+++ b/for_build/barrnap_only/Dockerfile
@@ -0,0 +1,23 @@
+from ubuntu:16.04
+
+# Update apt-get packages
+RUN apt-get update &&\
+    apt-get -y upgrade
+
+# Install package needed
+RUN apt-get install -y \
+        wget \
+        python3-pip
+
+# Update pip
+RUN pip3 install --upgrade pip
+
+# Install barrnap
+WORKDIR /tmp
+RUN wget https://github.com/tseemann/barrnap/archive/0.8.tar.gz &&\
+    tar -xf 0.8.tar.gz &&\
+    rm 0.8.tar.gz
+RUN ln -s /tmp/barrnap-0.8/bin/barrnap /usr/local/bin
+# Remove heavy useless files
+RUN rm -r /tmp/barrnap-0.8/examples /tmp/barrnap-0.8/build/*.aln
+
diff --git a/for_build/basics/Dockerfile b/for_build/basics/Dockerfile
new file mode 100644
index 00000000..4c124749
--- /dev/null
+++ b/for_build/basics/Dockerfile
@@ -0,0 +1,13 @@
+from ubuntu:16.04
+
+# Update apt-get packages
+RUN apt-get update &&\
+    apt-get -y upgrade
+
+# Install package needed
+RUN apt-get install -y \
+        wget \
+        python3-pip
+
+# Update pip
+RUN pip3 install --upgrade pip
diff --git a/Dockerfile b/for_tests/Dockerfile
similarity index 100%
rename from Dockerfile
rename to for_tests/Dockerfile
-- 
GitLab