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

Dockerizing the project #236

Open
elchivo1250 opened this issue May 12, 2018 · 3 comments
Open

Dockerizing the project #236

elchivo1250 opened this issue May 12, 2018 · 3 comments

Comments

@elchivo1250
Copy link

elchivo1250 commented May 12, 2018

This is not a question...more of a note to others.

I was trying to put this project into a docker container using docker-compose, and I ran into an issue viewing the page in my browser at http://localhost:8080. The browser was getting no response at all at that address. After a little investigation, I found that you need to add:

devServer: {
    ...
    host: "0.0.0.0",
    ...
}

to webpack.config.js to make the webpack dev server available externally. Hopefully this will save someone else a little headache.

Below are the config files for docker-compose in case anyone is interested. This is set up to put all project code in the ./app directory.

docker-compose.yml

version: "3"
services:
    app:
        image: node:9.11.1
        working_dir: /app
        volumes:
          - "./app:/app"
        ports:
            - "8080:8080"
        command: ["npm", "start"]

services.yml

version: "3"
services:
    test:
        image: node:9.11.1
        volumes:
            - "./app:/app"
        working_dir: /app
        entrypoint: ["npm", "run", "test", "--"]

    npm:
        image: node:9.11.1
        volumes:
            - "./app:/app"
        working_dir: /app
        entrypoint: "npm"
        command: "install"

Commands:
Run dev server: docker-compose up
NPM (default command is install): docker-compose -f services.yml run --rm npm [command]
Test: docker-compose -f services.yml run --rm test
Test watch: docker-compose -f services.yml run --rm test --watch

@aepod
Copy link

aepod commented May 13, 2018

I also had to add the following line in the devServer declaration, because it was giving me a header mismatch error:
disableHostCheck: true,

@elchivo1250
Copy link
Author

Thanks, @aepod. Out of curiosity, at what point did you run into that error?

@aepod
Copy link

aepod commented May 13, 2018

The app would come up, after the initial npm start, but you could not connect to it without the disableHostCheck. Running docker in a linux VM from the shell.

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

No branches or pull requests

2 participants