forked from redgeoff/couchdb-docker-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
93 lines (77 loc) · 2.97 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Credit: this work is heavily based on https://github.com/apache/couchdb-docker/blob/master/2.0.0/Dockerfile
# We use ubuntu instead of debian:jessie as we want Erlang >= 18 for CouchDB SSL support
FROM ubuntu
MAINTAINER Geoff Cox [email protected]
# Update distro to get recent list of packages
RUN apt-get update -y -qq
# Download runtime dependencies
RUN apt-get --no-install-recommends -y install \
erlang-nox \
erlang-reltool \
libicu55 \
libmozjs185-1.0 \
openssl \
curl
# Update package lists
RUN apt-get update -y -qq
# The certs need to be installed after we have updated the package lists
RUN apt-get --no-install-recommends -y install \
ca-certificates
# TODO: Installing nodejs adds almost 300 MB to our image! Even the official node image
# (https://hub.docker.com/_/node/) is 666 MB. Is the best solution to eventually rewrite
# docker-discover-tasks in lower level language like c++?
#
# Install nodejs
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nodejs \
&& npm install npm -g
# Assuming the build process stays the same, you should be able to just change value of
# COUCHDB_VERSION to upgrade to the latest source
ENV COUCHDB_VERSION 2.1.1
# Download CouchDB, build it and then clean up
RUN buildDeps=" \
g++ \
erlang-dev \
libcurl4-openssl-dev \
libicu-dev \
libmozjs185-dev \
make \
wget \
" \
&& apt-get --no-install-recommends -y install $buildDeps \
&& cd /usr/src \
&& wget http://www-us.apache.org/dist/couchdb/source/$COUCHDB_VERSION/apache-couchdb-$COUCHDB_VERSION.tar.gz \
&& tar xfz apache-couchdb-$COUCHDB_VERSION.tar.gz \
&& rm apache-couchdb-$COUCHDB_VERSION.tar.gz \
&& cd apache-couchdb-$COUCHDB_VERSION \
&& ./configure \
&& make release \
&& adduser --system \
--shell /bin/bash \
--group --gecos \
"CouchDB Administrator" couchdb \
&& mv ./rel/couchdb /home/couchdb \
&& cd ../ \
&& rm -rf apache-couchdb-$COUCHDB_VERSION \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/*
# Add config files
COPY local.ini /home/couchdb/couchdb/etc/local.d/
COPY vm.args /home/couchdb/couchdb/etc/
# Set up directories and permissions
RUN mkdir -p /home/couchdb/couchdb/data /home/couchdb/couchdb/etc/default.d \
&& find /home/couchdb/couchdb -type d -exec chmod 0770 {} \; \
&& chmod 0644 /home/couchdb/couchdb/etc/* \
&& chmod 775 /home/couchdb/couchdb/etc/*.d \
&& chown -R couchdb:couchdb /home/couchdb/couchdb/
# docker-discover-tasks allows the nodes to discover each other
RUN npm install -g docker-discover-tasks
WORKDIR /home/couchdb/couchdb
EXPOSE 5984 6984 4369 9100-9200
COPY couchdb-process.sh /couchdb-process.sh
COPY discover-process.sh /discover-process.sh
COPY set-up-process.sh /set-up-process.sh
COPY wait-for-host.sh /wait-for-host.sh
COPY wait-for-it.sh /wait-for-it.sh
COPY wrapper.sh /wrapper.sh
CMD ["/wrapper.sh"]