Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Basic Docker Setup #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[WIP] Basic Docker Setup #1

wants to merge 1 commit into from

Conversation

sigmarstern
Copy link

@sigmarstern sigmarstern commented Jul 13, 2016

First build the image using docker-compose build. First rm -rf node_modules. (Thanks @pgoetze for pointing that out) Then build the image using docker-compose build. This will:

  • Create a new Docker image based on node:argon
  • Runs npm install when building the image and keeps installed modules in /tmp/node_modules

Then create and start a new container based on the previously built image using docker-compose up. This will:

  • mount application directory to /app inside the container
  • create a symbolic link node_modules pointing to /tmp/node_modules if not already present
  • create a pre-commit git hook which invokes node_modules/pre-commit/hook inside the container
  • run npm run dev
  • expose port 8000 (babel) on the Docker machine's port 80
  • expose port 8080 (webpack) on the Docker machine's port 8080

@mattberridge, @pgoetze, @artibella could you please give it a try and also check, whether the pre-commit hook is working properly?

set -e

# Symlink /tmp/node_modules if necessary
if [ ! -h 'node_modules' ]; then
Copy link

@ghost ghost Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it needs a -d for checking the presence of the directory instead of -h for the shell inside of the container.

docker-compose up with-h fails for me the second time with:

$ docker-compose up
Starting irisfrontend_web_1
Attaching to irisfrontend_web_1
web_1  | Symlink preinstalled node_modules from /tmp
web_1  | ln: failed to create symbolic link '/app/node_modules/node_modules': File exists
irisfrontend_web_1 exited with code 1

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind—I forgot to delete the local node_modules, therefor it failed. Works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant