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

setup a docker image for ezgliding web #55

Closed
rochaporto opened this issue Jan 19, 2015 · 4 comments
Closed

setup a docker image for ezgliding web #55

rochaporto opened this issue Jan 19, 2015 · 4 comments
Milestone

Comments

@rochaporto
Copy link
Owner

No description provided.

@rochaporto rochaporto added this to the 0.5 milestone Jan 19, 2015
@rochaporto
Copy link
Owner Author

For reference, here's a tip to launch the docker daemon in a chromebook with crouton:

sudo /usr/bin/docker.io -d -b none --storage-driver=vfs

And then:

docker build -t ezgliding docker

@rochaporto
Copy link
Owner Author

A first try with:

FROM golang
WORKDIR /gopath/src/github.com/rochaporto/ezgliding
ADD . /gopath/src/github.com/rochaporto/ezgliding
RUN go get github.com/rochaporto/ezgliding
RUN go install github.com/rochaporto/ezgliding
ENTRYPOINT /gopath/bin/ezgliding web
EXPOSE 8000

works but has the disadvantage of actually rerunning the build to get the binary, which is not necessarily what we want for deployments. In particular it requires the golang image in FROM, so the resulting image is always bigger than 300MB, while the ezgliding binary is 9MB.

An alternative is described here:
https://medium.com/@kelseyhightower/optimizing-docker-images-for-static-binaries-b5696e26eb07

and we could instead create the image directly from within travis including the resulting binary.

@rochaporto
Copy link
Owner Author

Relevant links from the previous comment:
https://blog.golang.org/docker

and the magic of automated builds in dockerhub, though we might end up not using them:
http://docs.docker.com/userguide/dockerrepos/#automated-builds

@rochaporto
Copy link
Owner Author

With some like:

FROM scratch
MAINTAINER Ricardo Rocha <rocha.porto@gmail.com>
ADD ezgliding ezgliding
EXPOSE 8000
ENTRYPOINT ["/ezgliding"]

it looks pretty good:

# sudo docker build -t ezgliding .
Sending build context to Docker daemon 21.39 MB
Sending build context to Docker daemon 
Step 0 : FROM scratch
Pulling repository scratch
511136ea3c5a: Download complete 
 ---> 511136ea3c5a
Step 1 : MAINTAINER Ricardo Rocha <rocha.porto@gmail.com>
 ---> Running in 3136603cb9c3
 ---> aacd3791a68a
Removing intermediate container 3136603cb9c3
Step 2 : ADD ezgliding ezgliding
 ---> 11065f0a4972
Removing intermediate container ae93e510fefc
Step 3 : EXPOSE 8000
 ---> Running in c58d4efb1690
 ---> e909d3fa7142
Removing intermediate container c58d4efb1690
Step 4 : ENTRYPOINT ["/ezgliding"]
 ---> Running in b619c8c18e9e
 ---> ecdfa8e8f83b
Removing intermediate container b619c8c18e9e
Successfully built ecdfa8e8f83b

rochaporto added a commit that referenced this issue Jan 21, 2015
adds a dockerfile building the base image for ezgliding containers,
including the main binary. also adds an additional dockerfile-web which
sets up an entrypoint to run the web service.

includes documentation on how to generate the container images.

Fixes #55.
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

1 participant