Skip to content

Commit 07675aa

Browse files
committed
address review comments
1 parent 9a3af1d commit 07675aa

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

2.3.1/Dockerfile

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,45 @@ RUN set -ex; \
3333
ENV GOSU_VERSION 1.11
3434
ENV TINI_VERSION 0.18.0
3535
RUN set -ex; \
36-
\
37-
apt-get update; \
38-
apt-get install -y --no-install-recommends wget; \
39-
rm -rf /var/lib/apt/lists/*; \
40-
\
41-
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
42-
\
36+
\
37+
apt-get update; \
38+
apt-get install -y --no-install-recommends wget; \
39+
rm -rf /var/lib/apt/lists/*; \
40+
\
41+
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
42+
\
4343
# install gosu
44-
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$dpkgArch"; \
45-
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
46-
export GNUPGHOME="$(mktemp -d)"; \
44+
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$dpkgArch"; \
45+
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
46+
export GNUPGHOME="$(mktemp -d)"; \
4747
echo "disable-ipv6" >> ${GNUPGHOME}/dirmngr.conf; \
4848
for server in $(shuf -e pgpkeys.mit.edu \
4949
ha.pool.sks-keyservers.net \
5050
hkp://p80.pool.sks-keyservers.net:80 \
5151
pgp.mit.edu) ; do \
5252
gpg --batch --keyserver $server --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && break || : ; \
5353
done; \
54-
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
55-
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
56-
chmod +x /usr/local/bin/gosu; \
57-
gosu nobody true; \
54+
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
55+
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
56+
chmod +x /usr/local/bin/gosu; \
57+
gosu nobody true; \
5858
\
5959
# install tini
60-
wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-$dpkgArch"; \
61-
wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-$dpkgArch.asc"; \
62-
export GNUPGHOME="$(mktemp -d)"; \
60+
wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-$dpkgArch"; \
61+
wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-$dpkgArch.asc"; \
62+
export GNUPGHOME="$(mktemp -d)"; \
6363
echo "disable-ipv6" >> ${GNUPGHOME}/dirmngr.conf; \
6464
for server in $(shuf -e pgpkeys.mit.edu \
6565
ha.pool.sks-keyservers.net \
6666
hkp://p80.pool.sks-keyservers.net:80 \
6767
pgp.mit.edu) ; do \
6868
gpg --batch --keyserver $server --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && break || : ; \
6969
done; \
70-
gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini; \
71-
rm -rf "$GNUPGHOME" /usr/local/bin/tini.asc; \
72-
chmod +x /usr/local/bin/tini; \
70+
gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini; \
71+
rm -rf "$GNUPGHOME" /usr/local/bin/tini.asc; \
72+
chmod +x /usr/local/bin/tini; \
7373
apt-get purge -y --auto-remove wget; \
74-
tini --version
74+
tini --version
7575

7676
# http://docs.couchdb.org/en/latest/install/unix.html#installing-the-apache-couchdb-packages
7777
ENV GPG_COUCH_KEY \
@@ -121,12 +121,16 @@ COPY docker-entrypoint.sh /usr/local/bin
121121
RUN ln -s usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh # backwards compat
122122
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
123123

124+
125+
RUN set -xe; \
126+
# Check we own everything in /opt/couchdb. Matches the command in dockerfile_entrypoint.sh
127+
find /opt/couchdb \! \( -user couchdb -group couchdb \) -exec chown -f couchdb:couchdb '{}' +; \
124128
# Setup directories and permissions for config. Technically these could be 555 and 444 respectively
125-
# but we keep them as 755 and 644 for consistency with CouchDB defaults and the dockerfile_entrypoint.
126-
RUN find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod -f 0755 '{}' +; \
127-
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod -f 0644 '{}' +; \
128-
# only local.d needs to be writable for the docker_entrypoint.sh
129-
chmod -f 0777 /opt/couchdb/etc/local.d
129+
# but we keep them as 755 and 644 for consistency with CouchDB defaults and the dockerfile_entrypoint.sh.
130+
find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod -f 0755 '{}' +; \
131+
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod -f 0644 '{}' +; \
132+
# only local.d needs to be writable for the docker_entrypoint.sh
133+
chmod -f 0777 /opt/couchdb/etc/local.d
130134

131135
VOLUME /opt/couchdb/data
132136

0 commit comments

Comments
 (0)