Right now I expect it to be broken and also --dev mode is not what you would want to run in a production.
Is there a way to provide a production-ready docker file? We have to generate certs, add token secrets to the config etc. Maybe we can just make it clear that the dockerfile is for playing around with horizon?
We could definitely add some comment explanations in the Dockerfile itself, I'm not sure what the general expectations are when one clones a repo, and does docker build .
I know though that if you change the name from Dockerfile docker build . only searches for that filename so it will fail unless explicitly stated, it'd be nice if you could rename it dev_Dockerfile or prod_Dockerfile. For the meantime though, we should be explicit that it's just for local dev work.
I think possibly we could support both. We can provide the base Dockerfile for running and playing in development mode, but build a base container to host on Docker Hub.
The base image could be something like:
FROM node:4
WORKDIR /usr/horizon
COPY client/package.json /usr/horizon/client/package.json
COPY server/package.json /usr/horizon/server/package.json
RUN cd client; npm install
RUN cd server; npm install -g
COPY client /usr/horizon/client
COPY server /usr/horizon/server
EXPOSE 8181
ENTRYPOINY ["hz"]
CMD ["serve"]
Using it locally would look something like docker run -d --name hz-server -p "8181:8181" horizon serve --dev
Then folks wanting to extend it for production could:
FROM horizon:latest
COPY cert.pem /usr/horizon/
COPY config /usr/horizon
That's just a rough draft off of the top of my head, but I think it could be a good start. I should have some time this weekend to play around with it. If you want to prioritize CLI tests and docker stories and let me know which is most important right now.
I think it would also make sense to provide a docker-compose.yml that sets up RethinkDB with Horizon linked by the same network to be able to either quickly set up a fully functional running instance of Horizon - either in the cloud or locally.
If we go that far I would propose generating a Dockerfile and a docker-compose.yml on init and putting them behind a positional arg of --docker. We don't want to give the impression that docker is the only way to run horizon, but that developers can opt into docker with sane defaults.
We do have a docker-compose.yml right now actually that looks like it would still work just fine for dev. Thanks to help from @rosskukulinski.
@dalanmiller right, but isn't that more for hacking _on_ horizon and not developing _with_ horizon. The proposal, I thought, was for providing a production ready Docker image and/or Dockerfile, please correct me if I am wrong.
Having an official rethinkdb/horizon docker image would be 馃憣.
I 馃挅 @janders223 idea of creating a Dockerfile and docker-compose.yml on init. It would make onboarding devs onto a horizon project super simple, especially for people without too much background in node.
Hey all, I just PR'd #603, would love for you all to take a look!
@dalanmiller was this fixed by #603?
Most helpful comment
Having an official
rethinkdb/horizondocker image would be 馃憣.I 馃挅 @janders223 idea of creating a
Dockerfileanddocker-compose.ymlon init. It would make onboarding devs onto a horizon project super simple, especially for people without too much background in node.