0

I have a simple node program app.js
I mounted app.js file containing folder to a docker container.
When i do fig up it works.
But when i change contents of app.js and do fig stop and fig up again the changes are not loaded.
How can i make sure fig reloads / rebuilds image every time i bring it up ?

I tried various combination but no luck.
how to fix this?

debianmaster
  • 503
  • 7
  • 19

2 Answers2

2

Just mounting the volume (without actually using ADD in Dockerfile) helped me test on latest code every time i make a fig up

app.js
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end("hello world 5"); }).listen(3001);

Dockerfile FROM cjonagam/centos-nodejs-0.10.33 RUN mkdir /home/test2 WORKDIR /home/test2 EXPOSE 3001

app: build: . volumes: - .:/home/test2 ports: - "3001:3001" command: node app.js

debianmaster
  • 503
  • 7
  • 19
  • I would recommend https://github.com/b00giZm/fig-nodejs-examples/tree/master/04-express-grunt-watch is another good example with the same approach – dnephin Nov 24 '14 at 20:40
1

You need to call "fig build" to rebuild the container. I think it is easier to mount a directory on the host-system (via ADD in the dockerfile), you don't have to rebuild the container everytime then.

Johannes Reuter
  • 3,501
  • 19
  • 20