initial commit
diff --git a/Dockerfile b/Dockerfile
index ef0484d..37829f0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,63 +2,45 @@
MAINTAINER Clemens Stolle klaemo@fastmail.fm
-# Install instructions from https://cwiki.apache.org/confluence/display/COUCHDB/Debian
+ENV COUCHDB_VERSION developer-preview-2.0
-ENV COUCHDB_VERSION 1.6.1
-
-RUN groupadd -r couchdb && useradd -d /var/lib/couchdb -g couchdb couchdb
+RUN groupadd -r couchdb && useradd -d /usr/src/couchdb -g couchdb couchdb
# download dependencies
-RUN apt-get update -y && apt-get install -y lsb-release wget \
- && echo "deb http://binaries.erlang-solutions.com/debian `lsb_release -cs` contrib" \
- | tee /etc/apt/sources.list.d/erlang-solutions.list \
- && wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc \
- | apt-key add - \
- && echo "deb http://packages.cloudant.com/debian `lsb_release -cs` main" \
- | tee /etc/apt/sources.list.d/cloudant.list \
- && wget http://packages.cloudant.com/KEYS -O - | apt-key add - \
+RUN echo 'deb http://http.debian.net/debian wheezy-backports main' > /etc/apt/sources.list.d/backports.list \
&& apt-get update -y \
- && apt-get install -y erlang-nox erlang-dev build-essential \
- libmozjs185-cloudant libmozjs185-cloudant-dev \
- libnspr4 libnspr4-0d libnspr4-dev libcurl4-openssl-dev curl libicu-dev \
- --no-install-recommends \
- && rm -rf /var/lib/apt/lists/* \
- && curl -sSL http://apache.openmirror.de/couchdb/source/$COUCHDB_VERSION/apache-couchdb-$COUCHDB_VERSION.tar.gz -o couchdb.tar.gz \
- && curl -sSL http://www.apache.org/dist/couchdb/source/$COUCHDB_VERSION/apache-couchdb-$COUCHDB_VERSION.tar.gz.asc -o couchdb.tar.gz.asc \
- && curl -sSL http://www.apache.org/dist/couchdb/KEYS -o KEYS \
- && gpg --import KEYS && 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 \
- && curl -o /usr/local/bin/gosu -SkL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
- && chmod +x /usr/local/bin/gosu \
- && apt-get purge -y erlang-dev binutils cpp cpp-4.7 build-essential libmozjs185-cloudant-dev libnspr4-dev libcurl4-openssl-dev libicu-dev lsb-release wget \
- && apt-get autoremove -y \
- && apt-get update && apt-get install -y libicu48 --no-install-recommends \
- && rm -rf /var/lib/apt/lists/* \
- && rm -r /usr/src/couchdb \
- && rm /couchdb.tar.gz* /KEYS
+ && apt-get install -y --no-install-recommends build-essential libmozjs185-dev \
+ libnspr4 libnspr4-0d libnspr4-dev libcurl4-openssl-dev libicu-dev \
+ openssl curl ca-certificates git pkg-config \
+ apt-transport-https python \
+ && apt-get install -y -t wheezy-backports erlang-base-hipe erlang-dev \
+ erlang-manpages erlang-dialyzer erlang-eunit erlang-nox
+
+RUN git clone https://github.com/rebar/rebar /usr/src/rebar \
+ && (cd /usr/src/rebar ; make && mv rebar /usr/local/bin/)
+
+ RUN cd /usr/src \
+ && git clone https://git-wip-us.apache.org/repos/asf/couchdb.git \
+ && cd couchdb \
+ && git checkout developer-preview-2.0
+
+RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
+ && echo 'deb https://deb.nodesource.com/node wheezy main' > /etc/apt/sources.list.d/nodesource.list \
+ && echo 'deb-src https://deb.nodesource.com/node wheezy main' >> /etc/apt/sources.list.d/nodesource.list \
+ && apt-get update -y && apt-get install -y nodejs
+
+RUN cd /usr/src/couchdb \
+ && npm install -g grunt-cli \
+ && ./configure && make
# permissions
-RUN 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
+RUN chown -R couchdb:couchdb /usr/src/couchdb
+USER couchdb
# Expose to the outside
-RUN sed -e 's/^bind_address = .*$/bind_address = 0.0.0.0/' -i /usr/local/etc/couchdb/default.ini
+RUN sed -i'' 's/bind_address = 127.0.0.1/bind_address = 0.0.0.0/' /usr/src/couchdb/rel/overlay/etc/default.ini
-ADD ./docker-entrypoint.sh /entrypoint.sh
+EXPOSE 15984 25984 35984
+WORKDIR /usr/src/couchdb
-# Define mountable directories.
-VOLUME ["/usr/local/var/log/couchdb", "/usr/local/var/lib/couchdb"]
-
-EXPOSE 5984
-WORKDIR /var/lib/couchdb
-
-ENTRYPOINT ["/entrypoint.sh"]
-CMD ["couchdb"]
+ENTRYPOINT ["/usr/src/couchdb/dev/run"]
diff --git a/README.md b/README.md
index 4aada5a..6a2ffbd 100644
--- a/README.md
+++ b/README.md
@@ -4,51 +4,23 @@
Yet Another Dockerized CouchDB.
Put the couch in a docker container and ship it anywhere.
-If you're looking for a CouchDB with SSL support you can check out [klaemo/couchdb-ssl](https://index.docker.io/u/klaemo/couchdb-ssl/)
-
-Version: `CouchDB 1.6.1`
+Version: `CouchDB 2.0 developer preview`
## Run
-Available in the docker index as [klaemo/couchdb](https://index.docker.io/u/klaemo/couchdb/)
+Available on the docker registry as [klaemo/couchdb:2.0-dev](https://index.docker.io/u/klaemo/couchdb/)
```bash
-[sudo] docker pull klaemo/couchdb:latest
+# expose the cluster to the world
+[sudo] docker run -d -p 15984:15984 -p 25984:25984 -p 35984:35984 --name couchdb klaemo/couchdb:2.0-dev
-# expose it to the world on port 5984
-[sudo] docker run -d -p 5984:5984 --name couchdb klaemo/couchdb
-
-curl http://localhost:5984
+curl http://localhost:15984
+curl http://localhost:25984
+curl http://localhost:35984
```
-## Features
+...or you can pass arguments to the binary
-* built on top of the solid and small `debian:wheezy` base image
-* exposes CouchDB on port `5984` of the container
-* runs everything as user `couchdb` (security ftw!)
-* docker volumes for data and logs
-
-The previous version of this image used to come with a process manager to keep
-CouchDB running. As of Docker 1.2 you can use the `--restart` flag to accomplish this.
-
-## Build your own
-
-You can use `klaemo/couchdb` as the base image for your own couchdb instance.
-You might want to provide your own version of the following files:
-
-* `local.ini` for CouchDB
-
-Example Dockerfile:
-
-```
-FROM klaemo/couchdb
-
-COPY local.ini /usr/local/etc/couchdb/
-```
-
-and then build and run
-
-```
-[sudo] docker build -t you/awesome-couchdb .
-[sudo] docker run -d -p 5984:5984 -v ~/couchdb:/usr/local/var/lib/couchdb you/awesome-couchdb
+```bash
+docker run klaemo/couchdb:2.0-dev --admin=foo:bar
```
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
deleted file mode 100755
index 2245ab4..0000000
--- a/docker-entrypoint.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-set -e
-
-if [ "$1" = 'couchdb' ]; then
- # we need to set the permissions here because docker mounts volumes as root
- chown -R couchdb:couchdb \
- /usr/local/var/lib/couchdb \
- /usr/local/var/log/couchdb \
- /usr/local/var/run/couchdb \
- /usr/local/etc/couchdb
-
- chmod -R 0770 \
- /usr/local/var/lib/couchdb \
- /usr/local/var/log/couchdb \
- /usr/local/var/run/couchdb \
- /usr/local/etc/couchdb
-
- chmod 664 /usr/local/etc/couchdb/*.ini
- chmod 775 /usr/local/etc/couchdb/*.d
- exec gosu couchdb "$@"
-fi
-
-exec "$@"