Merge pull request #403 from akalipetis/docker-enhancement

Improve the Docker image
This commit is contained in:
Antonis Kalipetis
2016-12-30 11:24:22 +02:00
committed by GitHub
4 changed files with 48 additions and 2 deletions
+16
View File
@@ -0,0 +1,16 @@
node_modules/
*.swp
.lock-wscript
lib/
Makefile.gyp
*.Makefile
*.target.gyp.mk
*.node
example/*.log
docs/
npm-debug.log
/.idea/
.env
build/
.vscode/
.git/
+1
View File
@@ -5,6 +5,7 @@ indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
[*.{j,t}s]
max_line_length = 100
+22 -2
View File
@@ -1,4 +1,24 @@
FROM node:4-onbuild
FROM node:6.9
MAINTAINER Paris Kasidiaris <paris@sourcelair.com>
EXPOSE 3000
# Install cpio, used for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends cpio \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
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 \"${@:0}\";"]
CMD ["npm", "run", "dev"]
# First, install dependencies to improve layer caching
COPY package.json /usr/src/app/
RUN npm install
# Add the code
COPY . /usr/src/app
# Run the tests and build, to make sure everything is working nicely
RUN npm run build && npm run test
+9
View File
@@ -0,0 +1,9 @@
version: '2'
services:
web:
build: ./
volumes:
- ./:/usr/src/app
ports:
- 3000:3000