From 61c213f9e35e380b34ed3ae11726e8c353e01f5b Mon Sep 17 00:00:00 2001 From: Antonis Kalipetis Date: Thu, 29 Dec 2016 16:13:58 +0200 Subject: [PATCH] Ignore all the build directories in Docker This allows for reproducible builds. Also, fix Dockerfile to first build and then run tests and a typo in the entrypoint. Thanks @BenHall for reporting the issue with the Docker build! --- .dockerignore | 18 ++++++++++++++++-- Dockerfile | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index 651665bb..c837dec7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,16 @@ -node_modules -.git +node_modules/ +*.swp +.lock-wscript +lib/ +Makefile.gyp +*.Makefile +*.target.gyp.mk +*.node +example/*.log +docs/ +npm-debug.log +/.idea/ +.env +build/ +.vscode/ +.git/ diff --git a/Dockerfile b/Dockerfile index fa1a9209..36e821bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update \ WORKDIR /usr/src/app # Set an entrypoint, to automatically install node modules -ENTRYPOINT ["/bin/bash", "-c", "if [[ ! -d node_modules ]]; then npm install; fi; exec \"$@\";"] +ENTRYPOINT ["/bin/bash", "-c", "if [[ ! -d node_modules ]]; then npm install; fi; exec \"${@:0}\";"] CMD ["npm", "run", "dev"] # First, install dependencies to improve layer caching @@ -21,4 +21,4 @@ RUN npm install COPY . /usr/src/app # Run the tests and build, to make sure everything is working nicely -RUN npm run test && npm run build +RUN npm run build && npm run test