Last active
August 29, 2015 14:20
-
-
Save visualjeff/a53e76235f322b5afafd to your computer and use it in GitHub Desktop.
Dockerfile for debian and couchdb 1.6.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker version 1.6.x | |
# | |
# To build: sudo docker build --force-rm=true -t costco/couchdb:latest . | |
# To run: sudo docker run -d -p 5984:5984 -t costco/couchdb:latest | |
# | |
FROM debian:latest | |
MAINTAINER Jeffrey Gilbert | |
ENV DEBIAN_FRONTEND noninteractive | |
# Add erlang source location to debian sources | |
RUN apt-get update;apt-get install -y wget | |
RUN echo "deb http://packages.erlang-solutions.com/debian wheezy contrib" >> /etc/apt/sources.list | |
RUN wget -qO - http://packages.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add - | |
# Update system and install couchdb dependencies | |
RUN apt-get update && apt-get dist-upgrade -y;apt-get install -y build-essential curl erlang-nox erlang-dev libmozjs185-1.0 libmozjs185-dev libcurl4-openssl-dev libicu-dev python-pip automake autoconf autoconf-archive pkg-config libtool | |
WORKDIR /root | |
# Get couchdb source and build it | |
RUN wget -qO- https://github.com/apache/couchdb/archive/1.6.1.tar.gz | tar xz | |
RUN cd couchdb-1.6.1;touch THANKS;./bootstrap;./configure;make && make install;cd .. | |
RUN rm -rf couchdb-1.6.1 | |
# Install supervisor and supervisor-stdout to aggregates stdout for docker log | |
RUN easy_install supervisor==3.1.3;mkdir -p /var/log/supervisord;pip install supervisor-stdout | |
# All outside addresses to access couchdb. You might want to manage the couchdb using Futon. | |
RUN sed -e 's/^bind_address = .*$/bind_address = 0.0.0.0/' -i /usr/local/etc/couchdb/default.ini; | |
# Enable cors in couchdb | |
RUN sed -e 's/enable_cors = false$/enable_cors = true/' -i /usr/local/etc/couchdb/default.ini; | |
RUN echo "" >> /usr/local/etc/couchdb/default.ini; | |
RUN echo "[cors]" >> /usr/local/etc/couchdb/default.ini; | |
RUN echo "origins = *" >> /usr/local/etc/couchdb/default.ini; | |
RUN echo "methods = GET, PUT, POST, HEAD, DELETE" >> /usr/local/etc/couchdb/default.ini; | |
RUN echo "headers = accept, authorization, content-type, origin, referer" >> /usr/local/etc/couchdb/default.ini | |
# You could add stuff here! | |
# Expose ports | |
EXPOSE 5984 | |
# Add in supervisor config. | |
ADD ./supervisord.conf /usr/local/etc/supervisord.conf | |
# Do a little housekeeping to trim down the image size | |
RUN apt-get remove -y curl build-essential automake autoconf autoconf-archive pkg-config libtool;apt-get install python-minimal;apt-get clean;apt-get autoclean;apt-get autoremove -y;rm -rf /var/lib/{apt,dpkg,cache,log}/ /tmp/* /var/tmp/* | |
# Start supervisor | |
CMD ["/usr/local/bin/supervisord", "-c", "/usr/local/etc/supervisord.conf"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[supervisord] | |
logfile=/var/log/supervisord/supervisord.log ; supervisord log file | |
logfile_maxbytes=100MB ; maximum size of logfile before rotation | |
logfile_backups=10 ; number of backed up logfiles | |
loglevel=debug ; info, debug, warn, trace | |
pidfile=/var/run/supervisord.pid ; pidfile location | |
nodaemon=true ; run supervisord as a daemon | |
minfds=1024 ; number of startup file descriptors | |
minprocs=200 ; number of process descriptors | |
user=root ; default user | |
childlogdir=/var/log/supervisord/ ; where child log files will live | |
[rpcinterface:supervisor] | |
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | |
[supervisorctl] | |
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket | |
[unix_http_server] | |
file=/tmp/supervisor.sock | |
[program:couchdb] | |
command=couchdb | |
stdout_logfile=/var/log/supervisord/%(program_name)s.log | |
stderr_logfile=/var/log/supervisord/%(program_name)s.log | |
stderr_events_enabled=true | |
autostart=true | |
autorestart=true | |
;Source from https://github.com/coderanger/supervisor-stdout | |
[eventlistener:stdout] | |
command = supervisor_stdout | |
buffer_size = 100 | |
events = PROCESS_LOG | |
result_handler = supervisor_stdout:event_handler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment