Skip to content

Commit d15da93

Browse files
committed
initial revision
0 parents  commit d15da93

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM alpine:3.6
2+
3+
MAINTAINER davido
4+
5+
RUN apk add --no-cache --virtual=.build-deps \
6+
git \
7+
go \
8+
python \
9+
python-dev \
10+
nodejs \
11+
nodejs-npm \
12+
openssh \
13+
bash \
14+
curl \
15+
g++ \
16+
linux-headers \
17+
make \
18+
musl-dev \
19+
openjdk8 \
20+
sed \
21+
zip
22+
23+
# Install glibc: https://github.com/bazelbuild/rules_closure/issues/228
24+
RUN apk --no-cache add ca-certificates wget \
25+
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub \
26+
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.26-r0/glibc-2.26-r0.apk \
27+
&& apk add glibc-2.26-r0.apk
28+
29+
# Install Bazel from source: https://github.com/bazelbuild/bazel/issues/4034
30+
ENV BAZEL_VERSION 0.8.0rc1
31+
ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
32+
33+
# curl -SLO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip \
34+
RUN curl -SLO https://releases.bazel.build/0.8.0/rc1/bazel-0.8.0rc1-dist.zip \
35+
&& mkdir bazel-${BAZEL_VERSION} \
36+
&& unzip -qd bazel-${BAZEL_VERSION} bazel-${BAZEL_VERSION}-dist.zip \
37+
&& cd bazel-${BAZEL_VERSION} \
38+
&& bash compile.sh \
39+
&& cp -p output/bazel /usr/bin/
40+
41+
# Add links to javac and jar
42+
RUN cd /usr/bin \
43+
&& ln -s /usr/lib/jvm/java-1.8-openjdk/bin/javac . \
44+
&& ln -s /usr/lib/jvm/java-1.8-openjdk/bin/jar .

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# gerrit developer docker image based on Alpine Linux
2+
3+
To pull the prebuilt image from docker hub:
4+
5+
```
6+
$ docker pull davido42/bazel-build-gerrit
7+
```
8+
9+
[Optional] To build the image:
10+
11+
```
12+
$ docker build --no-cache=false -t davido42/bazel-build-gerrit .
13+
```
14+
15+
To run the image:
16+
17+
```
18+
$ docker run --privileged -ti --entrypoint=bash davido42/bazel-build-gerrit
19+
```
20+
21+
Optionaly: mount the host gerrit directory and cache directories:
22+
23+
```
24+
$ docker run --privileged -ti --entrypoint=bash -v ~/.gerritcodereview/buck-cache/downloaded-artifacts:/opt/downloaded-artifacts -v ~/.gerritcodereview/bazel-cache/cas:/opt/cas -v ~/projects/gerrit2:/opt/gerrit davido42/bazel-build-gerrit
25+
```
26+
27+
To create developer user in container execute as root:
28+
29+
```
30+
$ adduser -D -s /bin/bash <user>
31+
$ su - <user>
32+
```
33+
34+
To build gerrit run as developer user:
35+
36+
```
37+
$ git clone --recursive https://gerrit.googlesource.com/gerrit
38+
$ cd gerrit
39+
$ bazel build release
40+
```

0 commit comments

Comments
 (0)