diff --git a/.gitlab-ci.yaml b/.gitlab-ci.yaml new file mode 100644 index 0000000000000000000000000000000000000000..931974b0fdd0d8b605a788b81f2b2acc8c73e977 --- /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 5f4940a13d6d6a880b6dd382b26231644cefbaa4..e6478bd8fab6d2baedbc7f2427b66fc91debbdfb 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 0000000000000000000000000000000000000000..70a12c2a42fd47694c7c74046c1f9d8e2da9dd76 --- /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 +