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,75 @@
# 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.
FROM debian:jessie
LABEL maintainer="phithon <root@leavesongs.com>"
# Install instructions from https://cwiki.apache.org/confluence/display/COUCHDB/Debian
RUN groupadd -r couchdb && useradd -d /var/lib/couchdb -g couchdb couchdb
RUN apt-get update -y && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
erlang-nox \
libicu52 \
libmozjs185-1.0 \
libnspr4 \
libnspr4-0d \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root and tini for signal handling
RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture)" \
&& chmod +x /usr/local/bin/gosu \
&& curl -o /usr/local/bin/tini -fSL "https://github.com/krallin/tini/releases/download/v0.14.0/tini" \
&& chmod +x /usr/local/bin/tini
# download dependencies, compile and install couchdb,
# set correct permissions, expose couchdb to the outside and disable logging to disk
RUN buildDeps=' \
gcc \
g++ \
erlang-dev \
libcurl4-openssl-dev \
libicu-dev \
libmozjs185-dev \
libnspr4-dev \
make \
' \
&& apt-get update && apt-get install -y --no-install-recommends $buildDeps \
&& curl -fSL https://archive.apache.org/dist/couchdb/source/1.6.0/apache-couchdb-1.6.0.tar.gz -o couchdb.tar.gz \
&& mkdir -p /usr/src/couchdb \
&& tar -xzf couchdb.tar.gz -C /usr/src/couchdb --strip-components=1 \
&& cd /usr/src/couchdb \
&& ./configure --with-js-lib=/usr/lib --with-js-include=/usr/include/mozjs \
&& make && make install \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/* /usr/src/couchdb /couchdb.tar.gz* \
&& chown -R couchdb:couchdb \
/usr/local/lib/couchdb /usr/local/etc/couchdb \
/usr/local/var/lib/couchdb /usr/local/var/log/couchdb /usr/local/var/run/couchdb \
&& chmod -R g+rw \
/usr/local/lib/couchdb /usr/local/etc/couchdb \
/usr/local/var/lib/couchdb /usr/local/var/log/couchdb /usr/local/var/run/couchdb \
&& mkdir -p /var/lib/couchdb \
&& sed -e 's/^bind_address = .*$/bind_address = 0.0.0.0/' -i /usr/local/etc/couchdb/default.ini \
&& sed -e 's!/usr/local/var/log/couchdb/couch.log$!/dev/null!' -i /usr/local/etc/couchdb/default.ini
COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
EXPOSE 5984
WORKDIR /var/lib/couchdb
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
CMD ["couchdb"]

View File

@@ -0,0 +1,36 @@
#!/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
if [ "$1" = 'couchdb' ]; then
# we need to set the permissions here because docker mounts volumes as root
chown -R couchdb:couchdb \
/usr/local/var/lib/couchdb \
/usr/local/var/log/couchdb \
/usr/local/var/run/couchdb \
/usr/local/etc/couchdb
chmod -R 0770 \
/usr/local/var/lib/couchdb \
/usr/local/var/log/couchdb \
/usr/local/var/run/couchdb \
/usr/local/etc/couchdb
chmod 664 /usr/local/etc/couchdb/*.ini
chmod 775 /usr/local/etc/couchdb/*.d
exec gosu couchdb "$@"
fi
exec "$@"

View File

@@ -0,0 +1,59 @@
FROM debian:jessie
LABEL maintainer="phithon <root@leavesongs.com>"
COPY ./docker-entrypoint.sh /
RUN apt-get update -y && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
erlang-nox \
erlang-reltool \
haproxy \
libicu52 \
libmozjs185-1.0 \
openssl \
wget
RUN buildDeps=' \
apt-transport-https \
gcc \
g++ \
erlang-dev \
libcurl4-openssl-dev \
libicu-dev \
libmozjs185-dev \
make \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& rm -rf /var/lib/apt/lists/* \
&& cd /usr/src && mkdir couchdb \
&& wget -qO- https://archive.apache.org/dist/couchdb/source/2.1.0/apache-couchdb-2.1.0.tar.gz | tar zx -C couchdb --strip-components=1 \
&& cd couchdb \
# Build the release and install into /opt
&& ./configure --disable-docs \
&& 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 \
&& chmod +x /docker-entrypoint.sh
# Add configuration
COPY vm.args /opt/couchdb/etc/
WORKDIR /opt/couchdb
EXPOSE 5984 4369 9100
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/opt/couchdb/bin/couchdb"]

View File

@@ -0,0 +1,45 @@
#!/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 [ ! -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 "$@"

View File

@@ -0,0 +1,28 @@
# 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.
# Ensure that the Erlang VM listens on a known port
-kernel inet_dist_listen_min 9100
-kernel inet_dist_listen_max 9100
# Tell kernel and SASL not to log anything
-kernel error_logger silent
-sasl sasl_error_logger false
# Use kernel poll functionality if supported by emulator
+K true
# Start a pool of asynchronous IO threads
+A 16
# Comment this line out to enable the interactive Erlang shell on startup
+Bd -noinput

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 "$@"