diff --git a/.dockerignore b/.dockerignore index 74976a73..1019f996 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,5 @@ ./build +./coverage ./dist ./node_modules ./test diff --git a/.travis.yml b/.travis.yml index 29fb2974..7ceae3d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,16 @@ cache: directories: - node_modules +services: + - docker + install: - yarn install script: - yarn lint - yarn test:ci - - if [[ -z $TRAVIS_TAG ]]; then yarn build ; fi + - if [[ -z $TRAVIS_TAG ]]; then docker build -t shlink-web-client:test . ; fi # Test docker image build only when no tag is present after_success: - yarn ocular coverage/clover.xml diff --git a/Dockerfile b/Dockerfile index d6bd402f..05c1d33a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,8 @@ -FROM nginx:1.15.8-alpine +FROM node:10.15.2 as node +COPY . /shlink-web-client +RUN cd /shlink-web-client && yarn install && yarn build + +FROM nginx:1.15.9-alpine LABEL maintainer="Alejandro Celaya " - -# Install node and yarn -RUN apk add --no-cache nodejs && apk add --no-cache yarn - -ADD . ./shlink-web-client - -# Install dependencies and build project -RUN cd ./shlink-web-client && \ - yarn install && \ - yarn build && \ - - # Move build contents to document root - cd .. && \ - rm -r /usr/share/nginx/html/* && \ - mv ./shlink-web-client/build/* /usr/share/nginx/html && \ - rm -r ./shlink-web-client && \ - - # Delete and uninstall build tools - yarn cache clean && apk del yarn && apk del nodejs +RUN rm -r /usr/share/nginx/html +COPY --from=node /shlink-web-client/build /usr/share/nginx/html diff --git a/package.json b/package.json index a5a03091..2720942b 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,9 @@ "@fortawesome/free-regular-svg-icons": "^5.6.3", "@fortawesome/free-solid-svg-icons": "^5.6.3", "@fortawesome/react-fontawesome": "^0.1.3", + "array-filter": "^1.0.0", + "array-map": "^0.0.0", + "array-reduce": "^0.0.0", "axios": "^0.18.0", "bootstrap": "~4.1.1", "bottlejs": "^1.7.1", diff --git a/yarn.lock b/yarn.lock index dd1250a9..ef2345f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1209,9 +1209,10 @@ array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" -array-filter@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" +array-filter@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83" + integrity sha1-uveeYubvTCpMC4MSMtr/7CUfnYM= array-find-index@^1.0.1: version "1.0.2" @@ -1236,13 +1237,15 @@ array-includes@^3.0.3: define-properties "^1.1.2" es-abstract "^1.7.0" -array-map@~0.0.0: +array-map@^0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" + integrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= -array-reduce@~0.0.0: +array-reduce@^0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" + integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= array-union@^1.0.1: version "1.0.2"