forked from frodenas/docker-couchdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor code improvements in Dockerfile
Dropped `.sh` file extensions from set-up scripts, placed them under `/usr/local/bin/` (making them available in `$PATH`), finessed `RUN` command formatting.
- Loading branch information
1 parent
9a3193f
commit 55c1fc7
Showing
4 changed files
with
40 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,10 @@ MAINTAINER Krzysztof Kobrzak <[email protected]> | |
ENV COUCHDB_VERSION 1.6.1 | ||
|
||
# CouchDB dependencies and required utilities | ||
RUN DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get update && apt-get install -y --force-yes --no-install-recommends \ | ||
RUN \ | ||
apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y --force-yes --no-install-recommends \ | ||
build-essential \ | ||
curl \ | ||
erlang-dev \ | ||
|
@@ -18,34 +20,38 @@ RUN DEBIAN_FRONTEND=noninteractive && \ | |
netcat \ | ||
pwgen | ||
|
||
ADD scripts /usr/local/bin | ||
|
||
RUN \ | ||
groupadd -r couchdb && \ | ||
useradd -d /usr/local/var/lib/couchdb -g couchdb couchdb && \ | ||
chown -R couchdb:couchdb /usr/local/bin/* && \ | ||
chmod -R +x /usr/local/bin/* | ||
|
||
# CouchDB installation from source | ||
RUN DEBIAN_FRONTEND=noninteractive && \ | ||
RUN \ | ||
DEBIAN_FRONTEND=noninteractive && \ | ||
cd /usr/src && \ | ||
curl -s -o apache-couchdb.tar.gz http://mirror.ox.ac.uk/sites/rsync.apache.org/couchdb/source/$COUCHDB_VERSION/apache-couchdb-$COUCHDB_VERSION.tar.gz && \ | ||
tar -xzf apache-couchdb.tar.gz && \ | ||
cd /usr/src/apache-couchdb-$COUCHDB_VERSION && \ | ||
./configure && \ | ||
make --quiet && \ | ||
make install && \ | ||
sed -e 's/^bind_address = .*$/bind_address = 0.0.0.0/' -i /usr/local/etc/couchdb/default.ini | ||
|
||
# CORS support in CouchDB | ||
RUN sed -i '/\[httpd\]/a enable_cors = true' /usr/local/etc/couchdb/local.ini && \ | ||
echo '[cors] \ | ||
\norigins = * \ | ||
\ncredentials = true \ | ||
\nheaders = accept, authorization, content-type, origin, referer \ | ||
\nmethods = GET, PUT, POST, HEAD' >> /usr/local/etc/couchdb/local.ini | ||
|
||
RUN groupadd -r couchdb && \ | ||
useradd -d /usr/local/var/lib/couchdb -g couchdb couchdb | ||
make install | ||
|
||
ADD scripts /usr/local/scripts | ||
RUN \ | ||
sed -e 's/^bind_address = .*$/bind_address = 0.0.0.0/' -i /usr/local/etc/couchdb/default.ini && \ | ||
# CORS support in CouchDB | ||
sed -i '/\[httpd\]/a enable_cors = true' /usr/local/etc/couchdb/local.ini && \ | ||
echo '[cors] \ | ||
\norigins = * \ | ||
\ncredentials = true \ | ||
\nheaders = accept, authorization, content-type, origin, referer \ | ||
\nmethods = GET, PUT, POST, HEAD, DELETE' >> /usr/local/etc/couchdb/local.ini | ||
|
||
RUN touch /usr/local/scripts/couchdb-not-inited && \ | ||
chmod +x /usr/local/scripts/*.sh && \ | ||
chown -R couchdb:couchdb /usr/local/scripts && \ | ||
RUN \ | ||
mkdir /var/lib/couchdb && \ | ||
touch /var/lib/couchdb/couchdb-not-inited && \ | ||
chown -R couchdb:couchdb /var/lib/couchdb && \ | ||
chown -R couchdb:couchdb /usr/local/etc/couchdb && \ | ||
chown -R couchdb:couchdb /usr/local/var/lib/couchdb && \ | ||
|
@@ -56,7 +62,8 @@ RUN touch /usr/local/scripts/couchdb-not-inited && \ | |
chmod -R 0770 /usr/local/var/log/couchdb && \ | ||
chmod -R 0770 /usr/local/var/run/couchdb | ||
|
||
RUN apt-get purge -y \ | ||
RUN \ | ||
apt-get purge -y \ | ||
binutils \ | ||
build-essential \ | ||
cpp \ | ||
|
@@ -70,12 +77,12 @@ RUN apt-get purge -y \ | |
|
||
USER couchdb | ||
|
||
ENTRYPOINT ["/usr/local/scripts/start_couchdb.sh"] | ||
ENTRYPOINT ["start_couchdb"] | ||
CMD [""] | ||
|
||
EXPOSE 5984 | ||
|
||
WORKDIR /usr/local/scripts | ||
WORKDIR /usr/local/var/lib/couchdb | ||
|
||
# Expose our data, logs and configuration volumes | ||
VOLUME ["/usr/local/var/lib/couchdb", "/usr/local/var/log/couchdb", "/usr/local/etc/couchdb"] |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ -e /var/lib/couchdb/couchdb-not-inited ]]; then | ||
echo "Initialising CouchDB..." | ||
initialise_couchdb | ||
fi | ||
|
||
echo "Starting CouchDB..." | ||
/usr/local/bin/couchdb |
This file was deleted.
Oops, something went wrong.