first commit
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled

This commit is contained in:
2025-09-06 16:08:15 +08:00
commit 63285f61aa
2624 changed files with 88491 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
FROM debian:bullseye-slim
LABEL maintainer="phithon <root@leavesongs.com>"
RUN apt-get update -y && apt-get install -y --no-install-recommends \
erlang-nox \
erlang-reltool \
libicu-dev \
libcurl4-openssl-dev \
libnspr4-dev \
libffi-dev \
libmozjs-78-dev
RUN buildDeps=' \
gcc \
g++ \
erlang-dev \
make \
wget \
ca-certificates \
apt-transport-https \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& rm -rf /var/lib/apt/lists/* \
&& ln -s /usr/include/mozjs-78 /usr/local/include/mozjs-78 \
&& cd /usr/src && mkdir couchdb \
&& wget -qO- https://archive.apache.org/dist/couchdb/source/3.2.1/apache-couchdb-3.2.1.tar.gz | tar zx -C couchdb --strip-components=1 \
&& cd couchdb \
# Build the release and install into /opt
&& ./configure --disable-docs --spidermonkey-version=78 \
&& make release \
&& mv /usr/src/couchdb/rel/couchdb /opt/ \
# Cleanup build detritus
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/* /usr/src/couchdb* \
&& mkdir /opt/couchdb/data \
&& { \
echo "[chttpd]"; \
echo "bind_address = any"; \
echo ; \
echo "[httpd]"; \
echo "bind_address = any"; \
echo ; \
} | tee /opt/couchdb/etc/local.d/local.ini
# Add configuration
COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
WORKDIR /opt/couchdb
EXPOSE 5984 4369 9100
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/opt/couchdb/bin/couchdb"]

View File

@@ -0,0 +1,51 @@
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
set -e
# first arg is `-something` or `+something`
if [ "${1#-}" != "$1" ] || [ "${1#+}" != "$1" ]; then
set -- /opt/couchdb/bin/couchdb "$@"
fi
# first arg is the bare word `couchdb`
if [ "$1" = 'couchdb' ]; then
shift
set -- /opt/couchdb/bin/couchdb "$@"
fi
if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
if ! grep "inet_dist_listen_min" /opt/couchdb/etc/vm.args; then
echo "write inet_dist_listen_min and inet_dist_listen_max to /opt/couchdb/etc/vm.args"
echo "-kernel inet_dist_listen_min 9100" >> /opt/couchdb/etc/vm.args
echo "-kernel inet_dist_listen_max 9100" >> /opt/couchdb/etc/vm.args
fi
if [ ! -z "$NODENAME" ] && ! grep "couchdb@" /opt/couchdb/etc/vm.args; then
echo "-name couchdb@$NODENAME" >> /opt/couchdb/etc/vm.args
fi
if [ "$COUCHDB_USER" ] && [ "$COUCHDB_PASSWORD" ]; then
# Create admin
printf "[admins]\n%s = %s\n" "$COUCHDB_USER" "$COUCHDB_PASSWORD" > /opt/couchdb/etc/local.d/docker.ini
fi
if [ "$COUCHDB_SECRET" ]; then
# Set secret
printf "[couch_httpd_auth]\nsecret = %s\n" "$COUCHDB_SECRET" >> /opt/couchdb/etc/local.d/docker.ini
fi
fi
exec "$@"