Skip to content

Instantly share code, notes, and snippets.

@aimakun
Last active May 18, 2017 18:02
Show Gist options
  • Save aimakun/9292fbc7358a2c6eb4ccb29f03e11594 to your computer and use it in GitHub Desktop.
Save aimakun/9292fbc7358a2c6eb4ccb29f03e11594 to your computer and use it in GitHub Desktop.
Test run npm based projects with Docker Toolbox for Windows (solution for symlinks issues)
# This is partial container metadata for creating new container to store node_modules/.bin to handle symlink for Windows
# Choose one and use `docker-compose exec scripts [npm install|yarn|yarn start|etc] instead of build & run from scripts.sh below
# OPTION 1 - My project
scripts:
image: aimakun/nodejs-bower-grunt # for example
tty: true
volumes:
- .:/data
- /data/node_modules/.bin/
# OPTION 2 - Alternatives
scripts:
image: kkarczmarczyk/node-yarn:latest
tty: true
volumes:
- .:/workspace
- /workspace/node_modules/.bin/
ports: # Optional, set port if your app needs
- 3000:3000
FROM kkarczmarczyk/node-yarn:latest
COPY . /workspace
RUN yarn
EXPOSE 3000
#!/bin/sh
# maybe just exclude /workspace/node_modules/.bin instead of root directory
eval "docker build -t node-yarn . && docker run -it --rm --name=yarn -p 3000:3000 -v $(PWD):/workspace -v /workspace/node_modules node-yarn $@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment