Skip to content

Commit 5077c70

Browse files
committed
Move chown into same block as CouchDB install
There are some edge cases around chmod/chown in a separate layer on some graph drivers, so it's safer to keep this all in a single `RUN` block. Refs #151
1 parent defd42c commit 5077c70

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

2.3.1/Dockerfile

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,24 @@ RUN set -xe; \
112112
chmod 777 /opt/couchdb/data /opt/couchdb/var/log; \
113113
# Remove file that sets logging to a file
114114
rm /opt/couchdb/etc/default.d/10-filelog.ini; \
115-
rm -rf /var/lib/apt/lists/*
116-
117-
# Add configuration
118-
COPY 10-docker-default.ini /opt/couchdb/etc/default.d/
119-
COPY vm.args /opt/couchdb/etc/
120-
COPY docker-entrypoint.sh /usr/local/bin
121-
RUN ln -s usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh # backwards compat
122-
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
123-
124-
125-
RUN set -xe; \
126115
# Check we own everything in /opt/couchdb. Matches the command in dockerfile_entrypoint.sh
127116
find /opt/couchdb \! \( -user couchdb -group couchdb \) -exec chown -f couchdb:couchdb '{}' +; \
128117
# Setup directories and permissions for config. Technically these could be 555 and 444 respectively
129118
# but we keep them as 755 and 644 for consistency with CouchDB defaults and the dockerfile_entrypoint.sh.
130119
find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod -f 0755 '{}' +; \
131120
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod -f 0644 '{}' +; \
132121
# only local.d needs to be writable for the docker_entrypoint.sh
133-
chmod -f 0777 /opt/couchdb/etc/local.d
122+
chmod -f 0777 /opt/couchdb/etc/local.d; \
123+
# apt clean-up
124+
rm -rf /var/lib/apt/lists/*;
125+
126+
# Add configuration
127+
COPY --chown=couchdb 10-docker-default.ini /opt/couchdb/etc/default.d/
128+
COPY --chown=couchdb vm.args /opt/couchdb/etc/
129+
130+
COPY docker-entrypoint.sh /usr/local/bin
131+
RUN ln -s usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh # backwards compat
132+
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
134133

135134
VOLUME /opt/couchdb/data
136135

0 commit comments

Comments
 (0)