diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79ca272704b3cf4c09a46e28c831cd5f328c82ec..c1331abee27bf051135566aa17308a3eb08ab45c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,4 @@ variables: - DOCKER_DRIVER: overlay IMAGE_NAME: xpub BASE_DOMAIN: gateway.xpub.semioticsquares.com CONFIGURATION_REPOSITORY: https://gitlab.coko.foundation/pubsweet/infra.git @@ -14,15 +13,12 @@ stages: build: image: docker:latest - services: - - docker:dind 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 --pull -t $DOCKERHUB_USERNAME/$IMAGE_NAME . - - docker tag $DOCKERHUB_USERNAME/$IMAGE_NAME $DOCKERHUB_USERNAME/$IMAGE_NAME:$CI_COMMIT_SHA + - docker build -t $DOCKERHUB_USERNAME/$IMAGE_NAME:$CI_COMMIT_SHA . - docker push $DOCKERHUB_USERNAME/$IMAGE_NAME:$CI_COMMIT_SHA lint: diff --git a/Dockerfile b/Dockerfile index e883718f29978d4c8aa044524af78658017fc6b9..8fa68a4175d79cb2f23c89be33b7da2faa5fa7f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,39 +1,23 @@ -FROM node:8.9-alpine -MAINTAINER PubSweet Team <richard@coko.foundation> +FROM xpub/xpub:base -ENV HOME "/home/xpub" - -RUN mkdir -p ${HOME} - -# git required for yarn. Why isn't it included!? -# the rest is for compiling leveldown -RUN apk add --no-cache --virtual .gyp \ - python \ - curl \ - make \ - g++ \ - git - -RUN git config --global user.email "test@testing.com" && \ - git config --global user.name "Fakey McFakerson" - -WORKDIR ${HOME} - -COPY package.json yarn.lock lerna.json .eslintignore .eslintrc .prettierrc .stylelintignore .stylelintrc ./ +COPY package.json yarn.lock ./ +COPY lerna.json .eslintignore .eslintrc .prettierrc .stylelintignore .stylelintrc ./ COPY packages packages RUN [ "yarn", "config", "set", "workspaces-experimental", "true" ] + # We do a development install because react-styleguidist is a dev dependency RUN [ "yarn", "install", "--frozen-lockfile" ] -RUN [ "npm", "rebuild", "bcrypt", "--build-from-source=bcrypt"] +# Remove cache and offline mirror +RUN [ "yarn", "cache", "clean"] +RUN [ "rm", "-rf", "/npm-packages-offline-cache"] ENV NODE_ENV "production" # We are temporarily going to use the same image with different commands to deploy different apps in the monorepo. This is bad :(. WORKDIR ${HOME}/packages/xpub-collabra -# TODO pass in username and password as build arguments RUN [ "npx", "pubsweet", "build"] ## No xpub-ui to deploy yet