From ba31bb7dd4d1e1146eaf2597ea36ed3a878fcac0 Mon Sep 17 00:00:00 2001 From: Nick Santos Date: Sun, 19 Aug 2018 22:11:33 -0400 Subject: [PATCH] add instructions on how to build plovr in a docker container --- .dockerignore | 3 +++ Dockerfile | 9 +++++++++ Dockerfile.base | 16 ++++++++++++++++ README.md | 24 ++++++++++++++++++++++++ tools/imports/BUCK | 2 +- 5 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Dockerfile.base diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..ff9d3cc8d2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +.buckd +buck-out \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..150beded4f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM nicks/plovr-deps + +ADD . /plovr + +WORKDIR /plovr + +RUN buck fetch //third-party/... + +RUN buck test :test \ No newline at end of file diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000000..524121a471 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,16 @@ +# Builds the image nicks/plovr-base +FROM java:8 + +# Install deps +RUN apt update && apt install -y \ + git \ + ant \ + gcc \ + python \ + python-dev + +# Build BUCK +RUN git clone https://github.com/facebook/buck.git /buck/ +WORKDIR /buck +RUN ant +RUN ln -sf /buck/bin/buck /usr/bin/ \ No newline at end of file diff --git a/README.md b/README.md index 7df50748e2..eacda58202 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,30 @@ buck build plovr The output of the build will be in `buck-out/gen/plovr.jar`. +### Building Plovr inside a Docker container + +If you want to build plovr without installing Buck on your local machine, +we have a Docker container with Buck installed. + +The Plovr build is split into two Dockerfiles: + +- [Dockerfile](Dockerfile) builds and tests Plovr +- [Dockerfile.base](Dockerfile.base) builds Buck and Plovr's dependencies + +To test: + +``` +docker build . +``` + +downloads the plovr-deps container from docker, adds Plovr source, and runs all the Plovr tests. + +If you want to build `plovr-deps` yourself: + +``` +docker build -t nicks/plovr-deps -f Dockerfile.base . +``` + ### To Upgrade Closure Library To upgrade one of Closure Library, go to the official repo and find the SHA digest diff --git a/tools/imports/BUCK b/tools/imports/BUCK index 9c3f1cfdc6..70817aedee 100644 --- a/tools/imports/BUCK +++ b/tools/imports/BUCK @@ -2,7 +2,7 @@ genrule( name = 'rev-plovr', srcs = [], out = 'rev-plovr.txt', - cmd = 'git rev-parse HEAD > $OUT') + cmd = 'git rev-parse HEAD > $OUT || echo "head" > $OUT') java_library( name = 'revs',