diff --git a/Dockerfile b/Dockerfile index 79001c1..0d99666 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,26 +17,21 @@ RUN mkdir -p /data/db RUN apt-get install nodejs -y RUN apt-get install nodejs-legacy -y RUN apt-get install npm -y -RUN npm install -g nodemon -# install typescript +# for development: auto-restart on changes in backend (nodejs), auto-recompile on changes in frontend (ts->js) +RUN npm install -g nodemon RUN npm install -g typescript -# install pug -RUN npm install -g pug - -# install jshare for sharing node.js variables with client javascript -RUN npm install -g jshare # Create app directory RUN mkdir -p /usr/src/app WORKDIR /usr/src/app - # Install app dependencies ADD package.json /usr/src/app/ RUN npm install # Bundle app source +# file changes in . only lead to a rebuild which triggers only these remaining commands ADD . /usr/src/app EXPOSE 8080 diff --git a/docker-compose.yml b/docker-compose.yml index d53f736..b81c140 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,4 @@ services: - .:/usr/src/app ports: - "8080:8080" - - "5858:5858" - -# as gratefully discovered here: https://github.com/docker/labs/blob/master/developer-tools/nodejs-debugging/VSCode-README.md \ No newline at end of file + - "5858:5858" \ No newline at end of file diff --git a/package.json b/package.json index b52d6c5..33bf729 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,11 @@ "main": "course-planner.js", "scripts": { "prestart": "mongod --port 27017 --dbpath='/data/db' &", - "start": "mongoimport --db db --collection data --file data.json && nodemon -L /usr/src/app/", + "start": "mongoimport --db db --collection data --file data.json && node /usr/src/app/", "poststop": "mongod stop" }, - "devDependencies": { + "dependencies": { "express": "~4.14.0", - "nodemon": "~1.11.0", "mongoose": "~4.9.2", "typescript": "~2.2.2", "pug": "~2.0.0-beta11",