Skip to content

Commit fe058c4

Browse files
committed
Initial commit.
0 parents  commit fe058c4

File tree

4 files changed

+151
-0
lines changed

4 files changed

+151
-0
lines changed

Dockerfile

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
2+
FROM debian:jessie
3+
4+
ENV COUCHDB_VERSION couchdb-search
5+
6+
ENV MAVEN_VERSION 3.3.3
7+
8+
RUN groupadd -r couchdb && useradd -d /opt/couchdb -g couchdb couchdb
9+
10+
# download dependencies
11+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
12+
ca-certificates \
13+
curl \
14+
erlang-nox \
15+
erlang-reltool \
16+
libicu52 \
17+
libmozjs185-1.0 \
18+
openssl \
19+
libdbus-glib-1-2 \
20+
libllvm3.5 \
21+
openjdk-7-jdk \
22+
&& rm -rf /var/lib/apt/lists/*
23+
24+
# grab gosu for easy step-down from root and tini for signal handling
25+
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
26+
&& curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture)" \
27+
&& curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture).asc" \
28+
&& gpg --verify /usr/local/bin/gosu.asc \
29+
&& rm /usr/local/bin/gosu.asc \
30+
&& chmod +x /usr/local/bin/gosu \
31+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 6380DC428747F6C393FEACA59A84159D7001A4E5 \
32+
&& curl -o /usr/local/bin/tini -fSL "https://github.com/krallin/tini/releases/download/v0.9.0/tini" \
33+
&& curl -o /usr/local/bin/tini.asc -fSL "https://github.com/krallin/tini/releases/download/v0.9.0/tini.asc" \
34+
&& gpg --verify /usr/local/bin/tini.asc \
35+
&& rm /usr/local/bin/tini.asc \
36+
&& chmod +x /usr/local/bin/tini
37+
38+
RUN curl -fsSL http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar xzf - -C /usr/share \
39+
&& mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven \
40+
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
41+
42+
ENV MAVEN_HOME /usr/share/maven
43+
44+
ENV COUCHDB_VERSION 2.0.0
45+
46+
# Download dev dependencies
47+
RUN apt-get update -y -qq && apt-get install -y --no-install-recommends \
48+
apt-transport-https \
49+
build-essential \
50+
erlang-dev \
51+
libcurl4-openssl-dev \
52+
libicu-dev \
53+
libmozjs185-dev \
54+
ssh \
55+
git-core \
56+
supervisor \
57+
&& curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
58+
&& echo 'deb https://deb.nodesource.com/node_4.x jessie main' > /etc/apt/sources.list.d/nodesource.list \
59+
&& echo 'deb-src https://deb.nodesource.com/node_4.x jessie main' >> /etc/apt/sources.list.d/nodesource.list \
60+
&& apt-get update -y -qq \
61+
&& apt-get install -y nodejs \
62+
&& npm install -g grunt-cli \
63+
# Acquire CouchDB source code
64+
&& cd /usr/src \
65+
&& git clone https://github.com/sam/couchdb.git \
66+
&& cd couchdb \
67+
# Build the release and install into /opt
68+
&& ./configure --disable-docs \
69+
&& make release \
70+
&& mv /usr/src/couchdb/rel/couchdb /opt/ \
71+
# Cleanup build detritus
72+
&& cd /usr/src \
73+
&& git clone https://github.com/cloudant-labs/clouseau \
74+
&& cd /usr/src/clouseau \
75+
&& mvn -Dmaven.test.skip=true install \
76+
&& apt-get purge -y \
77+
binutils \
78+
build-essential \
79+
cpp \
80+
erlang-dev \
81+
git \
82+
libicu-dev \
83+
make \
84+
nodejs \
85+
perl \
86+
&& apt-get autoremove -y && apt-get clean \
87+
&& apt-get install -y libicu52 --no-install-recommends \
88+
&& rm -rf /var/lib/apt/lists/* /usr/lib/node_modules /usr/src/couchdb*
89+
90+
# Add configuration
91+
COPY local.ini /opt/couchdb/etc/
92+
COPY vm.args /opt/couchdb/etc/
93+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
94+
95+
# Setup directories and permissions
96+
RUN mkdir -p /opt/couchdb/data /opt/couchdb/etc/local.d /opt/couchdb/etc/default.d \
97+
&& chown -R couchdb:couchdb /opt/couchdb/
98+
99+
RUN mkdir -p /var/log/supervisor/ \
100+
&& chmod 755 /var/log/supervisor/
101+
102+
WORKDIR /opt/couchdb
103+
EXPOSE 5984 4369 9100
104+
VOLUME ["/opt/couchdb/data"]
105+
106+
# Expose to the outside
107+
ENTRYPOINT ["/usr/bin/supervisord"]

local.ini

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
; CouchDB Configuration Settings
2+
;
3+
; ; Custom settings should be made in this file. They will override settings
4+
; ; in default.ini, but unlike changes made to default.ini, this file won't be
5+
; ; overwritten on server upgrade.
6+
;
7+
; [chttpd]
8+
; bind_address = any

supervisord.conf

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[supervisord]
2+
nodaemon=true
3+
4+
[program:cloudant]
5+
command=/opt/couchdb/bin/couchdb --with-admin-party-please
6+
7+
[program:clouseau1]
8+
command=/bin/bash -c "cd /usr/src/clouseau && mvn scala:run -Dlauncher=clouseau1 -DFOREGROUND"

vm.args

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
2+
# use this file except in compliance with the License. You may obtain a copy of
3+
# the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations under
11+
# the License.
12+
13+
# Ensure that the Erlang VM listens on a known port
14+
-kernel inet_dist_listen_min 9100
15+
-kernel inet_dist_listen_max 9100
16+
17+
# Tell kernel and SASL not to log anything
18+
-kernel error_logger silent
19+
-sasl sasl_error_logger false
20+
21+
# Use kernel poll functionality if supported by emulator
22+
+K true
23+
24+
# Start a pool of asynchronous IO threads
25+
+A 16
26+
27+
# Comment this line out to enable the interactive Erlang shell on startup
28+
+Bd -noinput

0 commit comments

Comments
 (0)