-
Notifications
You must be signed in to change notification settings - Fork 8
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
Initial docker file #15
base: develop
Are you sure you want to change the base?
Conversation
nice one! does this allow people to edit the source code, and have it livereload within the docker container? |
not unless they edit the code within the docker container, they would have to rebuild and rerun manually sadly. we could have a script that does this bit automatically though? we need a README update on this, and brief docker setup otherwise it's meaningless. I will add it in tomorrow :) |
ah ok, i thought you could mount a drive within the container, that pointed
to the source directory on your machine, then the livereload would kick in
on file updates
…On Sat, 8 Jun 2019 at 03:07, Joseph Allen ***@***.***> wrote:
not unless they edit the code within the docker container, they would have
to rebuild and rerun manually sadly. we could have a script that does this
bit automatically though?
we need a README update on this, and brief docker setup otherwise it's
meaningless. I will add it in tomorrow :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#15?email_source=notifications&email_token=AAAR2UJHHWT4RHJGJXY6GH3PZMH6RA5CNFSM4HVTT3F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXHK5TI#issuecomment-500084429>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAR2UPTTEJDCD3J4SD3CM3PZMH6RANCNFSM4HVTT3FQ>
.
|
I don't know enough about docker to answer that, this PR won't do that though. @jaspajjr any advice on this? We can still merge this one and iterate on it for live reload. |
I don't have permission to push to Seans repo or this PR.
docker build -t mhp .
I propose adding the above to the README, not sure it's quite right though as Sean had the run command sorted. @seam345 |
I use a similar thing for running Vim in a docker container
The -v flag mounts a volume, which I think should work. |
I added everyone on this thread as collaborators to my forked version in case anyone wanted to make changes. |
I'm unsure -v is the right option it allows accessing a folder from outside docker inside, not the other way round.. If i get some time tomorrow I'll have a longer look into this. |
Updated the docker file to get live reloading to work. Added the comands I ran to get the docker container to work
I got it working with live reloading had to change the docker file quite a bit and the commands used to build and run was
All the code stays in the folder you pulled it down into, docker is purely just running the code and not storing it inside the container at all. |
it seems to run fine but still won't render when I go to localhost:3000 |
Oops, I've written an alternative setup that does live reload. I'll open a new PR |
lets marry the best of both world. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using -p should set the port to be published on the host, so you don't need to expose it in the image
I wouldn't bother building an image with so little in it as your latest commit. I'd just use the node image if you're going to do it like that.
docker run -p 3000:3000 -v "$(pwd)":/app -w /app --net=host node:10 npm run start
I've not tested the above because I'm on my windows box which doesn't support $(pwd)
I'd use node:10 rather than 10.1 so it can update. Shouldn't get any breaking changes on minor version increments.
I'd consider building an image, like your first commit, and using docker-compose up to simplify the process. This is mostly because of how hard it is to get the bind working properly. Due to docker not accepting . as a volume name and $(pwd) being bash only, I set up individual volumes for each subdirectory within the project, so livereload would work. It won't work for changes to the root of the project. so changes to package.json would require a rebuild of the image. This might be fixed by creating a bound volume for package.json although I think I tried this and it didn't seem to work.
- Summary
Initial pull request to iterate on with Joseph-allen #10
My docker file that I managed to get working at the meetup.
The two commands I used to get it running are below, I needed to run them as sudo but that was I accidentally installed docker as root.
- Test plan
Sadly I have done no test, other than being able to load the homepage.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)

Couldn't resist putting a picture of Lexi when she was a puppy.