1. Bump Node version to 6.9 - the latest LTS 2. Include the `cpio` binary, used during building 3. Ignore node_modules and .git directories for faster builds 4. Run the tests and build during the image build, to make sure the image is not built if these break 5. Make npm run dev the default command 6. Add an entrypoint to automatically install Node modules if they do nott exist Signed-off-by: Antonis Kalipetis <akalipetis@gmail.com>
26 lines
657 B
Docker
26 lines
657 B
Docker
FROM node:6.9
|
|
MAINTAINER Paris Kasidiaris <paris@sourcelair.com>
|
|
|
|
# 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
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
# 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 test && npm run build
|
|
CMD ["npm", "run", "dev"]
|