-
Notifications
You must be signed in to change notification settings - Fork 155
/
Dockerfile.build
53 lines (48 loc) · 2.28 KB
/
Dockerfile.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Builds Bottled Water and its dependencies inside a Docker container.
# The resulting image is quite large, because all the development tools
# are installed into it. However, the build process generates tar'ed
# binaries which you can copy out and apply to a base Postgres image.
#
# Usage:
#
# docker build -f build/Dockerfile.build -t bwbuild:v1 .
# docker run -it --name bwbuild --rm bwbuild:v1 bash
# (Meanwhile, in another terminal:)
# docker cp bwbuild:/avro-1.7.7.tar.gz tmp/
# docker cp bwbuild:/librdkafka-0.9.0.tar.gz tmp/
# docker cp bwbuild:/bottledwater-ext.tar.gz tmp/
# docker cp bwbuild:/bottledwater-bin.tar.gz tmp/
# (Now type `exit` in the bash shell above.)
#
# See the other Dockerfiles in this directory for using those build artifacts.
FROM postgres:9.4
RUN apt-get update && \
apt-get install -y \
build-essential \
cmake \
curl \
libcurl4-openssl-dev \
libjansson-dev \
libpq-dev \
pkg-config \
postgresql-server-dev-9.4
# Avro
RUN curl -o /root/avro-c-1.7.7.tar.gz -SL http://archive.apache.org/dist/avro/avro-1.7.7/c/avro-c-1.7.7.tar.gz && \
tar -xzf /root/avro-c-1.7.7.tar.gz -C /root && \
mkdir /root/avro-c-1.7.7/build && \
cd /root/avro-c-1.7.7/build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=RelWithDebInfo && \
make && make test && make install && cd / && \
tar czf avro-1.7.7.tar.gz usr/local/include/avro usr/local/lib/libavro* usr/local/lib/pkgconfig/avro-c.pc
# librdkafka
RUN curl -o /root/librdkafka-0.9.0.tar.gz -SL https://github.com/edenhill/librdkafka/archive/v0.9.0.tar.gz && \
tar -xzf /root/librdkafka-0.9.0.tar.gz -C /root && \
cd /root/librdkafka-0.9.0 && ./configure && make && make install && cd / && \
tar czf librdkafka-0.9.0.tar.gz usr/local/include/librdkafka usr/local/lib/librdkafka*
# Bottled Water
COPY . /root/bottledwater
RUN cd /root/bottledwater && \
make clean && make && make install && cd / && \
tar czf bottledwater-ext.tar.gz usr/lib/postgresql/9.4/lib/bottledwater.so usr/share/postgresql/9.4/extension/bottledwater* && \
cp /root/bottledwater/kafka/bottledwater /root/bottledwater/client/bwtest /usr/local/bin && \
tar czf bottledwater-bin.tar.gz usr/local/bin/bottledwater usr/local/bin/bwtest