mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Improve the Docker image
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>
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
.git
|
||||
+23
-2
@@ -1,4 +1,25 @@
|
||||
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
|
||||
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"]
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
web:
|
||||
build: ./
|
||||
volumes:
|
||||
- ./:/usr/src/app
|
||||
ports:
|
||||
- 3000:3000
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Install Node modules, if the `node_modules` directory does not exist
|
||||
if [[ ! -d node_modules ]]; then
|
||||
npm install;
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user