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

Adding docker support #522

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dockerizeallthethings
Copy link

  • Adding docker image files for both prod and dev use
  • Adding instructions to top level README.md to:
    • Run a copy of the prod version hosted on hub.docker to try out the project
    • Build and run an image that will listen to changes on the host machine (to allow developers to use an IDE on their host machine)

…mage with `docker build -f Dockerfile-prod -t <your image here> .`

- The Dockerfile is now for development mode.
- Adding additional steps for running in development mode, with support for hot reloading.
@coveralls
Copy link

coveralls commented Dec 27, 2017

Coverage Status

Coverage remained the same at 88.034% when pulling 94c264a on dockerizeallthethings:adding-docker-support into 97fc206 on coryhouse:master.

@nickytonline
Copy link
Collaborator

@dockerizeallthethings, thanks for the PR! Could you open an issue and link it to this PR? In general, we like to have a discussion about what goes into the project and an issue is the perfect place to do that. Cheers.

@coryhouse
Copy link
Owner

Thanks for the PR! Dumb question: How would we update the Docker image hosted on hub.docker later?

@dockerizeallthethings
Copy link
Author

dockerizeallthethings commented Jan 1, 2018 via email

@coryhouse
Copy link
Owner

Great! I'm housecor

@dockerizeallthethings
Copy link
Author

dockerizeallthethings commented Jan 1, 2018 via email

@kwelch
Copy link
Collaborator

kwelch commented Jan 2, 2018

I don't know much about docker so I cannot approve or deny of these changes. I am definitely excited about them though.

@mikedevita
Copy link
Contributor

I actually do something very similar to this already for a few projects, it helps to alleviate the complexities with managing various versions of nodejs and npm packages on my mac. I mount the root of the project folder into the container so i can then run the build if i wanted.

@nickytonline
Copy link
Collaborator

This is for implementing #529.

@nickytonline
Copy link
Collaborator

I haven't tried this locally yet, will try to take a peek at this tomorrow. Just curious why alpine instead of slim for Node? I haven't done a whole lot of Docker yet. New job's immersing me though 😉

@coryhouse
Copy link
Owner

I also don't know Docker well enough yet to vet this. I'm hoping to dive in soon for work but for now I'm no help on this.

Copy link
Contributor

@mikedevita mikedevita left a comment

Choose a reason for hiding this comment

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

I have pulled this PR down to my local machine and ran the docker image/build, and there a few things I noticed.

  1. you can't interact with the console when the image is running in foreground mode, so that needs some documentation work done I think as well. Things like clearing snapshots, etc don't work, basically anything that requires console/terminal interaction while npm run start -s is going.
  2. However, once you bind the ports to the host, the app loads fine and HMR and all the features as best as I can tell work just as if you ran this natively with the exception of the item mentioned above.

@nickytonline
Copy link
Collaborator

@dockerizeallthethings, sorry that this PR and issue has gone stale. Any ideas for the first point that @mikedevita mentions?

@acmitch
Copy link

acmitch commented Oct 12, 2018

I'm not a huge fan of this for a couple of reasons:

  • Only one Dockerfile should be provided and it should closely mimic a PROD environment.
  • The PROD Dockerfile should not build the project. This causes a lot of configuration headache. The dist folder should be built like normal, then copied over to the Docker image on creation.

If someone wants to develop using Docker, that should be put back on the developer, this PR is making A LOT of assumptions.

For example, I use react-slingshot in a multi-project build, but my react-slingshot project has dependencies on other projects that have to be built first. Therefore, the Dockerfile has to change accordingly. Also, the development Dockerfile assumes that we want to expose port 3000 and 3001, it could be that someone is using docker-compose and Nginx to proxy to 3000 and 3001.

In my opinion, this is a good start but not ready to merge. It's trying to accomplish too much. I'm going to FORK react-slingshot this weekend and try to implement some ENV configuration changes and I'll integrate Docker as well.

I'm going to attempt to solve :

@acmitch
Copy link

acmitch commented Oct 14, 2018

If anyone is curious about my Docker comment, check out the PR: #590

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.

8 participants