-
Notifications
You must be signed in to change notification settings - Fork 72
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
Improve the dockerfile #45
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
29a9245
cleanup apt cache | build without mysql
126edd2
Fixed the Dockerfile issue
00ba6da
Improve the dockerfile for mysql-client image
7d79739
Add SysBench with MySQL support
88765ff
Add bash support
3d3bff1
Remove python3 and --no-install-recommends
eae9346
Reduce docker image layer
0602944
Bug fix
dde97f8
Add moreutils package
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
FROM ubuntu:16.04 | ||
|
||
RUN apt-get clean \ | ||
RUN apt-get update && apt-get -y --force-yes install \ | ||
python \ | ||
python-pip \ | ||
make \ | ||
automake \ | ||
libmysqlclient-dev \ | ||
libtool \ | ||
libsasl2-dev \ | ||
libssl-dev \ | ||
libmongoc-dev \ | ||
libbson-dev \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& apt-get update -y || true \ | ||
&& apt-get install -y -f \ | ||
make \ | ||
automake \ | ||
libmysqlclient-dev \ | ||
libtool \ | ||
libsasl2-dev \ | ||
libssl-dev \ | ||
libmongoc-dev \ | ||
libbson-dev | ||
|
||
RUN cp /usr/include/libbson-1.0/* /usr/include/ \ | ||
&& cp /usr/include/libmongoc-1.0/* /usr/include/ | ||
&& cp /usr/include/libbson-1.0/* /usr/include/ \ | ||
&& cp /usr/include/libmongoc-1.0/* /usr/include/ \ | ||
&& pip install --upgrade pip \ | ||
&& /usr/local/bin/pip install pystrich pymongo | ||
|
||
ADD sysbench-mongo/sysbench /sysbench | ||
WORKDIR /sysbench | ||
RUN ./autogen.sh && ./configure && make | ||
# components for liveness script | ||
RUN apt-get update && apt-get -y --force-yes install --no-install-recommends \ | ||
python3 \ | ||
python \ | ||
python-pip | ||
RUN pip install --upgrade setuptools | ||
RUN pip install --upgrade pip | ||
RUN python -m pip install pystrich | ||
|
||
# components for liveness script | ||
ADD liveness/server.py ./ | ||
|
||
|
||
RUN python -m pip install pymongo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
FROM ubuntu | ||
MAINTAINER OpenEBS | ||
RUN apt-get update | ||
RUN apt-get install -y mysql-client timelimit jq moreutils | ||
FROM alpine | ||
|
||
LABEL maintainer="OpenEBS" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bilal-mk In our liveness script we used bash commands and Alpine docker image doesn't have bash installed by default. You will need to add following commands to get bash: |
||
RUN apk add --no-cache mysql-client && apk add --no-cache jq && apk add --no-cache bash \ | ||
&& apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing moreutils | ||
|
||
COPY MySQLLoadGenerate.sh mysql-liveness-check.sh / |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks for the changes @bilal-mk. This changes seems to be good but we tested this Docker file in our own environment and it doesn't work for the purpose. Can you kindly push the changes with the following Docker spec:
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.
Same is this pull request with reduced the few-layer as part of the Dockerfile best practice. Please share how to properly test this or add those test as part of travis integration test.
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.
Agreed @bilal-mk. Have raised #49 & #50 to track this.
Currently travis performs a build check alone for all the images and doesn't look for existence of packages/artifacts specified in the Dockerfile (saw a few commits pushed as "fixes" for those that broke the build), which is what has necessitated certain manual tests. One way of testing this is to look at the python/bash scripts being pushed into the image & verifying the presence of the binaries &/or auxiliary files used in it in the locally built image. Or maybe simpler, compare the existing docker image layers w/ the one built with changes (docker diff, docker export - or even simply entering the fs)
Amongst the multiple docker images maintained in this repo & litmus - hacktoberfest has helped us refactor the images & its CI to the "extent possible", i.e., w/o breaking prod deployments where they are being used as K8s resources. Of course, further optimizations are possible by refactoring the scripts used in them (which came about before containerizing them!) - but these will be taken up based on priority.
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.
The dockerfile actually looks good. However, In this particular case, the following seem to sporadically cause a skipped install of some packages (though this shouldn't ideally impact us) :
Having said this, it may also depend on the build environment where the build is happening (its n/w connections, proxy settings etc.,).
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.
The travis build has passed(https://api.travis-ci.org/v3/job/443697398/log.txt) & I have tested this on a GCP compute instance (you can guarantee a clean build env here!). So, we should be good to go.
We will revisit this for further optimizations