From fd2eeea4dd5b546287d26f985e35c0fa0941781a Mon Sep 17 00:00:00 2001 From: "Juan Picado @jotadeveloper" Date: Sat, 2 Dec 2017 15:15:12 +0100 Subject: [PATCH] refactor: run test on build Docker image --- .dockerignore | 6 +++--- Dockerfile | 10 ++++++++-- package.json | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 3cdd2a257..eda779d6a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,9 +12,9 @@ !.eslintrc !.eslintignore !.stylelintrc - -# not going to run tests inside the docker container -test/ +!.flowconfig +!.jest.config.js +!.jestEnvironment.js # do not copy over node_modules we will run `npm install` anyway node_modules diff --git a/Dockerfile b/Dockerfile index beee00cfe..2b308ceed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,11 @@ LABEL maintainer="https://github.com/verdaccio/verdaccio" RUN apk --no-cache add openssl && \ wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \ chmod +x /usr/local/bin/dumb-init && \ - apk del openssl + apk del openssl && \ + apk --no-cache add ca-certificates wget && \ + wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \ + wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk && \ + apk add glibc-2.25-r0.apk ENV APPDIR /usr/local/app @@ -16,9 +20,11 @@ ENV NODE_ENV=production RUN npm config set registry http://registry.npmjs.org/ && \ npm install -g -s --no-progress yarn@0.28.4 --pure-lockfile && \ + npm install -g -s flow-bin && \ yarn install --production=false && \ + yarn run lint && \ + yarn run test && \ yarn run build:webui && \ - yarn run code:build && \ yarn cache clean && \ yarn install --production=true --pure-lockfile diff --git a/package.json b/package.json index 13d3b8984..f702338aa 100644 --- a/package.json +++ b/package.json @@ -137,14 +137,14 @@ "prepublish": "in-publish && npm run build:webui || not-in-publish", "flow": "flow", "pretest": "npm run code:build", - "test": "cross-env jest", + "test": "cross-env BABEL_ENV=test jest", "pre:ci": "npm run build:webui", "coverage:publish": "codecov", "lint": "npm run flow && eslint .", "lint:css": "stylelint 'src/**/*.scss' --syntax scss", "dev:start": "cross-env BABEL_ENV=registry babel-node src/lib/cli", "code:build": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --ignore src/webui/ --copy-files", - "pre:webpack": "npm run lint && rimraf static/*", + "pre:webpack": "rimraf static/*", "dev:webui": "cross-env BABEL_ENV=ui babel-node tools/dev.server.js", "build:webui": "npm run pre:webpack && BABEL_ENV=ui webpack --config tools/webpack.prod.config.babel.js", "build:docker": "docker build -t verdaccio . --no-cache",