From cd920d26700b0b7cb58308f4b017efea9bd5e295 Mon Sep 17 00:00:00 2001 From: Samuel Galson <samgalson@gmail.com> Date: Mon, 8 Jan 2018 15:47:15 +0000 Subject: [PATCH] add image --- .gitlab-ci.yaml | 15 +++++++++++++++ README.md | 9 ++++++++- images/xpub-base/Dockerfile | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yaml create mode 100644 images/xpub-base/Dockerfile diff --git a/.gitlab-ci.yaml b/.gitlab-ci.yaml new file mode 100644 index 0000000..931974b --- /dev/null +++ b/.gitlab-ci.yaml @@ -0,0 +1,15 @@ +stages: + - build + +build:xpub:base: + image: docker:latest + stage: build + script: + - docker version + - docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD + - echo "Ignore warning! Cannot perform an interactive login from a non TTY device" + - docker build -t xpub/xpub:base ./images/xpub-base + - docker push xpub/xpub:base + only: + - master + when: manual diff --git a/README.md b/README.md index 5f4940a..e6478bd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # `xpub` Deployment Config -This repository contains the templates used by [xpub](https://gitlab.coko.foundation/xpub/xpub) to deploy to Kubernetes. +This repository contains a base image for [xpub](https://gitlab.coko.foundation/xpub/xpub) and the templates used to deploy to Kubernetes. + +## Templates See [pubsweet/infra](https://gitlab.coko.foundation/pubsweet/infra) and [pubsweet/deployer](https://gitlab.coko.foundation/pubsweet/deployer) for more details about how these templates work. + +## Image + +The base image for xpub creates a yarn offline mirror from the current `xpub` repository in order to speed up builds there. It can be rebuilt and pushed to docker hub by triggering the relevant job in this repository. The image for `xpub` itself extends this base image. + diff --git a/images/xpub-base/Dockerfile b/images/xpub-base/Dockerfile new file mode 100644 index 0000000..70a12c2 --- /dev/null +++ b/images/xpub-base/Dockerfile @@ -0,0 +1,19 @@ +FROM pubsweet/pubsweet:base + +ENV HOME "/home/xpub" + +RUN mkdir -p ${HOME} + +WORKDIR ${HOME} + +# Build yarn offline cache + +RUN yarn config set yarn-offline-mirror /npm-packages-offline-cache && \ + yarn config set prefer-offline true && \ + yarn config set yarn-offline-mirror-pruning true + +RUN git clone https://gitlab.coko.foundation/xpub/xpub.git && \ + cd xpub && \ + yarn autoclean --init && yarn && \ + cd && rm -rf xpub + -- GitLab