|
| 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"] |
0 commit comments