diff --git a/docker-couchdb/Dockerfile b/docker-couchdb/Dockerfile deleted file mode 120000 index 1434d73a0011835ee1de4f1e0ef78f45c4a6167d..0000000000000000000000000000000000000000 --- a/docker-couchdb/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -Dockerfile-1.6.0 \ No newline at end of file diff --git a/docker-couchdb/Dockerfile b/docker-couchdb/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..76d656b33b1146b3ada7d547469d594cfa0a5f0c --- /dev/null +++ b/docker-couchdb/Dockerfile @@ -0,0 +1,127 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +FROM debian:jessie + +MAINTAINER Dave Lane dave@oerfoundation.org +# (adapted from work by Clemens Stolle klaemo@apache.org) +# Purpose - run a full WENotes stack including the faye message server, +# the wenotes service with couchdb, and various external processing tools +# +# The aim: to make a manageable fully functional dev environment which +# fosters remote API-ification for registering new blog users, +# updating details for session validation, and possibly integrating Mautic... +# subdue the "Dialog" errors... +ENV DEBIAN_FRONTEND noninteractive + +# Install instructions from https://cwiki.apache.org/confluence/display/COUCHDB/Debian + +RUN groupadd -r couchdb && useradd -d /var/lib/couchdb -g couchdb couchdb + +RUN apt-get update -y && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + erlang-nox \ + libicu52 \ + libmozjs185-1.0 \ + libnspr4 \ + libnspr4-0d \ + locales \ + && rm -rf /var/lib/apt/lists/* + +# grab gosu for easy step-down from root and tini for signal handling +RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture)" \ + && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture).asc" \ + && gpg --verify /usr/local/bin/gosu.asc \ + && rm /usr/local/bin/gosu.asc \ + && chmod +x /usr/local/bin/gosu \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 6380DC428747F6C393FEACA59A84159D7001A4E5 \ + && curl -o /usr/local/bin/tini -fSL "https://github.com/krallin/tini/releases/download/v0.9.0/tini" \ + && curl -o /usr/local/bin/tini.asc -fSL "https://github.com/krallin/tini/releases/download/v0.9.0/tini.asc" \ + && gpg --verify /usr/local/bin/tini.asc \ + && rm /usr/local/bin/tini.asc \ + && chmod +x /usr/local/bin/tini + +# https://www.apache.org/dist/couchdb/KEYS +ENV GPG_KEYS \ + 15DD4F3B8AACA54740EB78C7B7B7C53943ECCEE1 \ + 1CFBFA43C19B6DF4A0CA3934669C02FFDF3CEBA3 \ + 25BBBAC113C1BFD5AA594A4C9F96B92930380381 \ + 4BFCA2B99BADC6F9F105BEC9C5E32E2D6B065BFB \ + 5D680346FAA3E51B29DBCB681015F68F9DA248BC \ + 7BCCEB868313DDA925DF1805ECA5BCB7BB9656B0 \ + C3F4DFAEAD621E1C94523AEEC376457E61D50B88 \ + D2B17F9DA23C0A10991AF2E3D9EE01E47852AEE4 \ + E0AF0A194D55C84E4A19A801CDB0C0F904F4EE9B +RUN set -xe \ + && for key in $GPG_KEYS; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done + +ENV COUCHDB_VERSION 1.6.1 + +# download dependencies, compile and install couchdb, +# set correct permissions, expose couchdb to the outside and disable logging to disk +RUN buildDeps=' \ + gcc \ + g++ \ + erlang-dev \ + libcurl4-openssl-dev \ + libicu-dev \ + libmozjs185-dev \ + libnspr4-dev \ + make \ + ' \ + && apt-get update && apt-get install -y --no-install-recommends $buildDeps \ + && curl -fSL http://apache.osuosl.org/couchdb/source/$COUCHDB_VERSION/apache-couchdb-$COUCHDB_VERSION.tar.gz -o couchdb.tar.gz \ + && curl -fSL https://www.apache.org/dist/couchdb/source/$COUCHDB_VERSION/apache-couchdb-$COUCHDB_VERSION.tar.gz.asc -o couchdb.tar.gz.asc \ + && gpg --verify couchdb.tar.gz.asc \ + && mkdir -p /usr/src/couchdb \ + && tar -xzf couchdb.tar.gz -C /usr/src/couchdb --strip-components=1 \ + && cd /usr/src/couchdb \ + && ./configure --with-js-lib=/usr/lib --with-js-include=/usr/include/mozjs \ + && make && make install \ + && apt-get purge -y --auto-remove $buildDeps \ + && rm -rf /var/lib/apt/lists/* /usr/src/couchdb /couchdb.tar.gz* \ + && chown -R couchdb:couchdb \ + /usr/local/lib/couchdb /usr/local/etc/couchdb \ + /usr/local/var/lib/couchdb /usr/local/var/log/couchdb /usr/local/var/run/couchdb \ + && chmod -R g+rw \ + /usr/local/lib/couchdb /usr/local/etc/couchdb \ + /usr/local/var/lib/couchdb /usr/local/var/log/couchdb /usr/local/var/run/couchdb \ + && mkdir -p /var/lib/couchdb \ + && sed -e 's/^bind_address = .*$/bind_address = 0.0.0.0/' -i /usr/local/etc/couchdb/default.ini \ + && sed -e 's!/usr/local/var/log/couchdb/couch.log$!/dev/null!' -i /usr/local/etc/couchdb/default.ini + +COPY couchdb/couchdb-init.sh / +RUN chmod +x /couchdb-init.sh + +# Set up the language variables +ENV LANG en_NZ.UTF-8 +ENV LANGUAGE en_NZ.UTF-8 +ENV LC_ALL en_NZ.UTF-8 +# Compile the language spec +RUN locale-gen $LANG +# +# Some final exports to get the environment right... +RUN echo "export VISIBLE=now" >> /etc/profile \ + && echo "export TERM=xterm" >> /etc/bash.bashrc + +# Define mountable directories. +VOLUME ["/usr/local/var/lib/couchdb"] + +EXPOSE 5984 +WORKDIR /var/lib/couchdb + +ENTRYPOINT ["tini", "--", "/couchdb-init.sh"] +CMD ["couchdb"]