Skip to content

Commit

Permalink
Migrated to phusion baseimage
Browse files Browse the repository at this point in the history
  • Loading branch information
GraanJonlo committed May 6, 2015
1 parent 24646ca commit 4356afc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 55 deletions.
62 changes: 28 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,60 +1,54 @@
# Set base image to Debian
FROM graanjonlo/erlang:17.4
FROM phusion/baseimage:0.9.16

# File Author / Maintainer
MAINTAINER Andy Grant <[email protected]>

# Common set up
RUN \
apt-get update && \
apt-get install -y curl apt-utils wget && \
apt-get upgrade -y

# grab gosu for easy step-down from root
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu

# CouchDB dependencies
RUN \
apt-get install -y libmozjs185-1.0 libmozjs185-dev build-essential libnspr4 libnspr4-0d libnspr4-dev libcurl4-openssl-dev curl libicu-dev
RUN echo "deb http://binaries.erlang-solutions.com/debian `lsb_release -cs` contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list

RUN apt-get update && apt-get upgrade -y && apt-get install -y \
lsb-release \
wget

ENV ERLANG_VERSION 17.5

RUN wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add - && \
apt-get update && apt-get install -y \
build-essential \
curl \
erlang-base-hipe=1:$ERLANG_VERSION \
erlang-dev=1:$ERLANG_VERSION \
erlang-nox=1:$ERLANG_VERSION \
libcurl4-openssl-dev \
libicu-dev \
libmozjs185-1.0 \
libmozjs185-dev \
libnspr4 \
libnspr4-0d \
libnspr4-dev

# Add CouchDB user
RUN \
groupadd -r couchdb && useradd -d /var/lib/couchdb -g couchdb couchdb && \
RUN groupadd -r couchdb && useradd -d /var/lib/couchdb -g couchdb couchdb && \
mkdir -p /usr/local/{lib,etc}/couchdb /usr/local/var/{lib,log,run}/couchdb /var/lib/couchdb /usr/src/couchdb && \
chown -R couchdb:couchdb /usr/local/{lib,etc}/couchdb /usr/local/var/{lib,log,run}/couchdb && \
chmod -R g+rw /usr/local/{lib,etc}/couchdb /usr/local/var/{lib,log,run}/couchdb

ENV COUCHDB_VERSION 1.6.1

# Install CouchDB
RUN \
curl -sSL http://mirrors.ukfast.co.uk/sites/ftp.apache.org/couchdb/source/$COUCHDB_VERSION/apache-couchdb-$COUCHDB_VERSION.tar.gz -o couchdb.tar.gz && \
RUN curl -sSL http://mirrors.ukfast.co.uk/sites/ftp.apache.org/couchdb/source/$COUCHDB_VERSION/apache-couchdb-$COUCHDB_VERSION.tar.gz -o couchdb.tar.gz && \
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

# Remove package lists as we no longer need them
RUN rm -rf /var/lib/apt/lists/*

# Expose to the outside
RUN sed -e 's/^bind_address = .*$/bind_address = 0.0.0.0/' -i /usr/local/etc/couchdb/default.ini

# Define mountable directories
VOLUME ["/usr/local/var/log/couchdb", "/usr/local/var/lib/couchdb"]

# Set entrypoint
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
RUN mkdir /etc/service/couchdb
ADD couchdb.sh /etc/service/couchdb/run

# Expose ports
EXPOSE 5984

# Define default command.
CMD ["couchdb"]
CMD ["/sbin/my_init", "--quiet"]

13 changes: 13 additions & 0 deletions couchdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

chown couchdb:couchdb /usr/local/etc/couchdb
chmod 0755 /usr/local/etc/couchdb
chown couchdb:couchdb /usr/local/var/log/couchdb
chmod 0755 /usr/local/var/log/couchdb
chown couchdb:couchdb /usr/local/var/lib/couchdb
chmod 0755 /usr/local/var/lib/couchdb
chown couchdb:couchdb /usr/local/var/run/couchdb
chmod 0755 /usr/local/var/run/couchdb

exec /sbin/setuser couchdb /usr/local/bin/couchdb

21 changes: 0 additions & 21 deletions docker-entrypoint.sh

This file was deleted.

0 comments on commit 4356afc

Please sign in to comment.