PyconUK / pyconuk.github.io

OLD REPOS - DO NOT USE. PyCon UK website
http://www.pyconuk.org/
3 stars 9 forks source link

Dockerfile to serve this repo. #25

Closed snim2 closed 9 years ago

snim2 commented 9 years ago

Build with 'docker build .' and run with something like 'sudo docker run -ti a16d7681862b -p 4000:4000'

Still needs more work, and some documentation in the README

ghickman commented 9 years ago

@snim2 – I was using this Dockerfile recently and it has some directives in there that might be of use, specifically the COPY and WORKDIR ones?

We'll also need to test this out on OS X (where Docker isn't as simple) which I can hopefully look into tonight/this weekend.

snim2 commented 9 years ago

Interesting, I was planning to use ADD.

ghickman commented 9 years ago

@snim2 – To be super clear here - I've not set up Docker before so please don't think I'm telling you what to use!

snim2 commented 9 years ago

OK, pushed some plausible changes, but likely won't have time to properly test this until next week.

inglesp commented 9 years ago

I can build this on my OSX laptop, but when I try to run it, I can't connect to port 4000.

Can somebody else on OSX (@doismellburning, @ghickman?) give this a go?

doismellburning commented 9 years ago

@inglesp Are you sure you're connecting to the right IP? boot2docker uses a Vagrant box to run the Docker daemon - you don't want localhost:4000 you want $vagrantip:4000 - check $DOCKER_HOST

ghickman commented 9 years ago

@inglesp – boot2docker ip will give you the external IP of the docker instance. I couldn't get it to resolve under any of localhost:4000, dockerip:4000 of dockerip. I tried telling jekyll to serve on the external IP by adding -H 0.0.0.0 to the ENTRYPOINT section but it didn't seem to do anything.

doismellburning commented 9 years ago

@inglesp Oh sorry, I should have checked the Dockerfile - it's still missing --host 0.0.0.0

doismellburning commented 9 years ago

So I lifted https://gist.github.com/doismellburning/60c97b2e688b92e6eba3 from another project, which may be of interest? It uses a few more intermediary layers for caching goodness, and doesn't duplicate the Gemfile

doismellburning commented 9 years ago

(Want me to PR it this way?)

doismellburning commented 9 years ago

(Also don't forget the port forward; try something like docker build -t pyconukorg . && docker run -p 4000:4000 -ti pyconukorg)

ghickman commented 9 years ago

I've tested out @doismellburning's Dockerfile locally and it all seems to be working for me.

One thing to note - we could serve the site at port 80 by changing the port mapping to 80:4000.

inglesp commented 9 years ago

I've tested this with @doismellburning's Dockerfile, and it half works... I can run jekyll inside docker which builds the site, and I can access the site from my browser, but any changes to I make to the code are not reflected when I refresh the site until I restart the docker container.

In order to fix this, I've updated the Dockerfile (see https://gist.github.com/inglesp/08e5113f20124de0f3f2). You'll then need to run docker run -p 80:4000 -v $(pwd):/opt/pyconuk/site:rw -ti pyconuk.org.

doismellburning commented 9 years ago

I'm terribly sorry for ever starting the trend of contribution-via-gist

inglesp commented 9 years ago

Meta question: what's the right way :tm: to do this kind of collaboration?

doismellburning commented 9 years ago

TBH probably multiple PRs - I was concerned it might seem rude though if I rocked up with my own totally distinct PR, but actually, turning up with a gist was probably worse, sorry :s

snim2 commented 9 years ago

So, do you just want to close this PR and start another one?

ntoll commented 9 years ago

Hi,

I've been trying to get this to work by following the instructions at #26. Several observations:

:-(

I propose we all: