-
Notifications
You must be signed in to change notification settings - Fork 280
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
Make unit tests run in a Docker container #274
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
db12183
Added unit tests docker file
dcrankshaw 2c06b51
more updates to docker files
dcrankshaw c4ec591
updated dockerfiles
dcrankshaw 9a91a29
Format check is working
dcrankshaw 53258a6
pretty sure dockerized tests are passing
dcrankshaw 296bed6
move CI docker command to script
dcrankshaw 09170df
added todo
dcrankshaw 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
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,40 +1,17 @@ | ||
FROM frolvlad/alpine-gxx | ||
FROM ubuntu:16.04 | ||
|
||
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories | ||
|
||
RUN apk add --no-cache git bash make boost-dev cmake libev-dev hiredis-dev zeromq-dev \ | ||
libtool automake autoconf-archive@testing lz4-dev xz-dev snappy-dev zlib-dev \ | ||
glog-dev@testing scons openssl-dev libevent-dev | ||
|
||
# Set up Folly | ||
|
||
## Install DoubleConversion | ||
RUN git clone https://github.com/google/double-conversion \ | ||
&& cd double-conversion \ | ||
&& git checkout tags/v3.0.0 \ | ||
&& cmake -DBUILD_SHARED_LIBS=ON . \ | ||
&& make \ | ||
&& make install \ | ||
&& ln -s src double-conversion | ||
|
||
ENV DOUBLE_CONVERSION_HOME=/double-conversion/double-conversion/ | ||
|
||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DOUBLE_CONVERSION_HOME | ||
|
||
## Install GFLags | ||
RUN git clone https://github.com/gflags/gflags \ | ||
&& cd gflags \ | ||
&& git checkout tags/v2.2.1 \ | ||
&& mkdir build \ | ||
&& cd build \ | ||
&& cmake -DBUILD_SHARED_LIBS=ON .. \ | ||
&& make install | ||
RUN apt-get update && apt-get install -y g++ automake autoconf autoconf-archive libtool libboost-all-dev \ | ||
libevent-dev libdouble-conversion-dev libgoogle-glog-dev libgflags-dev liblz4-dev \ | ||
liblzma-dev libsnappy-dev make zlib1g-dev binutils-dev libjemalloc-dev libssl-dev \ | ||
pkg-config libiberty-dev git cmake libev-dev libhiredis-dev libzmq5 libzmq5-dev | ||
|
||
## Install Folly | ||
RUN git clone https://github.com/facebook/folly \ | ||
&& cd folly/folly \ | ||
&& git checkout tags/v2017.08.14.00 \ | ||
&& autoreconf -ivf \ | ||
&& ./configure LDFLAGS=-L$DOUBLE_CONVERSION_HOME/ CPPFLAGS=-I$DOUBLE_CONVERSION_HOME \ | ||
&& make \ | ||
&& ./configure \ | ||
&& make -j4 \ | ||
&& make install | ||
|
||
# vim: set filetype=dockerfile: |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
ARG CODE_VERSION=develop | ||
FROM clipper/lib_base:${CODE_VERSION} | ||
|
||
# install docker | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install --fix-missing -y \ | ||
wget apt-transport-https ca-certificates curl software-properties-common \ | ||
openjdk-8-jdk clang-format \ | ||
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ | ||
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ | ||
&& apt-get update \ | ||
&& apt-get install -y docker-ce | ||
|
||
RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh \ | ||
&& wget --quiet 'https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh' -O /tmp/anaconda.sh \ | ||
&& /bin/bash /tmp/anaconda.sh -b -p /opt/conda \ | ||
&& rm /tmp/anaconda.sh | ||
ENV PATH "/opt/conda/bin:$PATH" | ||
RUN conda install -y libgcc pyzmq | ||
|
||
RUN pip install requests subprocess32 scikit-learn numpy scipy fabric pyyaml docker \ | ||
kubernetes pyspark docker-compose findspark | ||
|
||
RUN mkdir /spark && cd /spark \ | ||
&& curl -o spark.tgz https://d3kbcqa49mib13.cloudfront.net/spark-2.1.1-bin-hadoop2.7.tgz \ | ||
&& tar zxf spark.tgz && rm spark.tgz | ||
|
||
ENV SPARK_HOME /spark/spark-2.1.1-bin-hadoop2.7 | ||
|
||
# Install maven | ||
ARG MAVEN_VERSION=3.5.0 | ||
ARG SHA=beb91419245395bd69a4a6edad5ca3ec1a8b64e41457672dc687c173a495f034 | ||
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries | ||
|
||
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ | ||
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-$MAVEN_VERSION-bin.tar.gz \ | ||
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha256sum -c - \ | ||
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ | ||
&& rm -f /tmp/apache-maven.tar.gz \ | ||
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn \ | ||
&& git clone https://github.com/zeromq/jzmq.git /root/jzmq \ | ||
&& cd /root/jzmq/jzmq-jni \ | ||
&& ./autogen.sh \ | ||
&& ./configure \ | ||
&& make \ | ||
&& make install | ||
|
||
ENV MAVEN_HOME /usr/share/maven | ||
ENV MAVEN_CONFIG /root/.m2 | ||
ENV JZMQ_HOME /usr/local/lib/ | ||
|
||
|
||
COPY ./ /clipper | ||
|
||
# Patch Clipper | ||
RUN cd /clipper/src/libs/spdlog \ | ||
&& git apply ../patches/make_spdlog_compile_linux.patch | ||
|
||
|
||
ENTRYPOINT ["/clipper/bin/ci_checks.sh"] | ||
|
||
# vim: set filetype=dockerfile: |
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
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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
unset CDPATH | ||
# one-liner from http://stackoverflow.com/a/246128 | ||
# Determines absolute path of the directory containing | ||
# the script. | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# Let the user start this script from anywhere in the filesystem. | ||
$DIR/check_format.sh | ||
$DIR/run_unittests.sh |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -u | ||
|
||
# TODO: Remove the /tmp volume mount in the Clipper admin refactor PR | ||
docker run --rm --network=host -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp clipper/unittests:develop |
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.
From an ease of development standpoint, this change of base image is a plus. Any concerns about the difference in image size and overhead?
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.
Not at this point. We can always build a minimal size docker image on alpine in the future. But that doesn't seem super important right now.
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.
Imo there shouldn't really be any since this is a base file used for frontend containers that we won't be replicating as frequently as model containers. Merging...