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

Docker automated build fails after change to alpine base image #7

Closed
haxorof opened this issue Apr 23, 2017 · 5 comments
Closed

Docker automated build fails after change to alpine base image #7

haxorof opened this issue Apr 23, 2017 · 5 comments
Labels

Comments

@haxorof
Copy link
Contributor

haxorof commented Apr 23, 2017

After change to alpine:3.5 it seems the build at Docker fails.
https://hub.docker.com/r/dbhi/prometheus-sql/builds/

Reason for this is that in the golang base image everything was built during container creation. However there is a golang:alpine base image which might be possible to use that would be smaller than the golang:onbuild which might be something to try.

@haxorof haxorof added the bug label Apr 23, 2017
@haxorof
Copy link
Contributor Author

haxorof commented Apr 23, 2017

Compared the sizes between building a container of prometheus-sql as it is right now and compared that to golang:alpine.

dbhi/prometheus-sql:latest = 11.8M
             golang:alpine = 267.2M

Size difference is quite significant. So looking into options like publish releases here in Github and then use wget/curl to get those when the automated build process is started for Docker hub.

@bruth When is the automated build triggered at Docker Hub? Or is manually triggered?

@haxorof haxorof added project and removed bug labels Apr 24, 2017
@haxorof
Copy link
Contributor Author

haxorof commented Apr 25, 2017

After some testing it seems prometheus-sql won't run in the alpine container probably because Alpine uses musl libc instead of glibc. However using a different base image like frolvlad/alpine-glibc:alpine-3.5 will make it work.

So if we publish a release here on Github for prometheus-sql then the Dockerfile could be something like this:

FROM frolvlad/alpine-glibc:alpine-3.5

ARG PROMETHEUS_SQL_VERSION=0.1.0
ARG BASE_URL=https://github.com/chop-dbhi/prometheus-sql/releases/download/$PROMETHEUS_SQL_VERSION
ARG OS_ARCH=linux-amd64
ARG ZIP_FILE=prometheus-sql-${OS_ARCH}.zip

ADD $BASE_URL/$ZIP_FILE /tmp/
RUN unzip /tmp/$ZIP_FILE -d /tmp \
  && cp /tmp/$OS_ARCH/* /usr/local/bin/ \
  && rm -rf /tmp/*

EXPOSE 8080

ENTRYPOINT ["/usr/local/bin/prometheus-sql", "-host", "0.0.0.0"]

# Default command assumes the SQL agent is linked.
CMD ["-service", "http://sqlagent:5000"]

@bruth What do you think about this?

@bruth
Copy link
Contributor

bruth commented Apr 25, 2017

@haxorof So it was automated before, but I only recently switched to a manual build (120c2f5) once I realized how big the image was. That 11.8 megs is because I cross-compiled locally and packaged it up into an alpine image.

After some testing it seems prometheus-sql won't run in the alpine container probably because Alpine uses musl libc instead of glibc.

Bah, i've run into that quite a few times. Your solution is pretty slick, I never thought about that approach, but looks great for continuing to use automated builds.

@haxorof
Copy link
Contributor Author

haxorof commented Apr 25, 2017

Thanks! I will do some additional tests and later do a commit with a new Docker file. Shall see what is possible to do regarding releases here on Github to make it as easy and smooth as possible. I have used it in my own little repo before but never together with a automated Docker build.

@bruth If you turn on automatic builds again will it then start building upon commit?

@bruth
Copy link
Contributor

bruth commented Apr 25, 2017

Yes. I just turned it back on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants