Skip to content

Instantly share code, notes, and snippets.

@iamdanthedev
Created August 13, 2017 08:32
Show Gist options
  • Save iamdanthedev/fada64e4015ba1a1a3a651a3ad41e4fa to your computer and use it in GitHub Desktop.
Save iamdanthedev/fada64e4015ba1a1a3a651a3ad41e4fa to your computer and use it in GitHub Desktop.
CouchDB 2.1.0 Dockerfile
# 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 Clemens Stolle klaemo@apache.org
# Add CouchDB user account
RUN groupadd -r couchdb && useradd -d /opt/couchdb -g couchdb couchdb
RUN apt-get update -y && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
erlang-nox \
erlang-reltool \
git \
haproxy \
libicu52 \
libmozjs185-1.0 \
openssl \
&& 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.14.0/tini" \
&& curl -o /usr/local/bin/tini.asc -fSL "https://github.com/krallin/tini/releases/download/v0.14.0/tini.asc" \
&& gpg --verify /usr/local/bin/tini.asc \
&& rm /usr/local/bin/tini.asc \
&& chmod +x /usr/local/bin/tini
# Download dev dependencies
RUN buildDeps=' \
apt-transport-https \
gcc \
g++ \
erlang-dev \
libcurl4-openssl-dev \
libicu-dev \
libmozjs185-dev \
make \
' \
&& apt-get update -y -qq && apt-get install -y --no-install-recommends $buildDeps
# Install nodejs 6, grunt-cli
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
&& apt-get install -y nodejs
# && npm install -g npm@3.5.0 \
RUN ["npm", "install", "-g", "grunt-cli"]
# Acquire CouchDB source code
RUN cd /usr/src && mkdir couchdb \
&& git clone https://github.com/apache/couchdb.git \
&& cd couchdb \
# Build the release and install into /opt
&& ./configure --disable-docs \
&& make release \
&& mv /usr/src/couchdb/rel/couchdb /opt/ \
# Cleanup build detritus
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/* /usr/lib/node_modules /usr/src/couchdb*
# Add configuration
COPY local.ini /opt/couchdb/etc/local.d/
COPY vm.args /opt/couchdb/etc/
COPY ./docker-entrypoint.sh /
# # Setup directories and permissions
RUN chmod +x /docker-entrypoint.sh \
&& mkdir /opt/couchdb/data \
# /opt/couchdb/etc/default.d \
&& chown -R couchdb:couchdb /opt/couchdb/
WORKDIR /opt/couchdb
EXPOSE 5984 4369 9100
VOLUME ["/opt/couchdb/data"]
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
CMD ["/opt/couchdb/bin/couchdb"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment