mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Stand-alone container for a BigchainDB node
This commit is contained in:
parent
4795a78d49
commit
973dec43af
59
Dockerfile-all-in-one
Normal file
59
Dockerfile-all-in-one
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
LABEL maintainer "dev@bigchaindb.com"
|
||||||
|
|
||||||
|
ARG TM_VERSION=0.22.8
|
||||||
|
RUN mkdir -p /usr/src/app
|
||||||
|
ENV HOME /root
|
||||||
|
COPY . /usr/src/app/
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
RUN apk --update add sudo bash \
|
||||||
|
&& apk --update add python3 openssl ca-certificates git \
|
||||||
|
&& apk --update add --virtual build-dependencies python3-dev \
|
||||||
|
libffi-dev openssl-dev build-base jq \
|
||||||
|
&& apk add --no-cache libstdc++ dpkg gnupg \
|
||||||
|
&& pip3 install --upgrade pip cffi \
|
||||||
|
&& pip install --no-cache-dir --process-dependency-links -e .[dev] \
|
||||||
|
&& apk del build-dependencies \
|
||||||
|
&& rm -f /var/cache/apk/*
|
||||||
|
|
||||||
|
# Install mongodb and monit
|
||||||
|
RUN apk --update add mongodb monit
|
||||||
|
|
||||||
|
# Install Tendermint
|
||||||
|
RUN wget https://github.com/tendermint/tendermint/releases/download/v${TM_VERSION}-autodraft/tendermint_${TM_VERSION}_linux_amd64.zip \
|
||||||
|
&& unzip tendermint_${TM_VERSION}_linux_amd64.zip \
|
||||||
|
&& mv tendermint /usr/local/bin/ \
|
||||||
|
&& rm tendermint_${TM_VERSION}_linux_amd64.zip
|
||||||
|
|
||||||
|
ENV TMHOME=/tendermint
|
||||||
|
|
||||||
|
RUN addgroup tmuser \
|
||||||
|
&& adduser -S -G tmuser tmuser -h "$TMHOME"
|
||||||
|
|
||||||
|
# Set permissions required for mongodb
|
||||||
|
RUN mkdir -p /data/db /data/configdb \
|
||||||
|
&& chown -R mongodb:mongodb /data/db /data/configdb
|
||||||
|
|
||||||
|
# When developing with Python in a docker container, we are using PYTHONBUFFERED
|
||||||
|
# to force stdin, stdout and stderr to be totally unbuffered and to capture logs/outputs
|
||||||
|
ENV PYTHONUNBUFFERED 0
|
||||||
|
|
||||||
|
# BigchainDB enviroment variables
|
||||||
|
ENV BIGCHAINDB_DATABASE_PORT 27017
|
||||||
|
ENV BIGCHAINDB_DATABASE_BACKEND localmongodb
|
||||||
|
ENV BIGCHAINDB_SERVER_BIND 0.0.0.0:9984
|
||||||
|
ENV BIGCHAINDB_WSSERVER_HOST 0.0.0.0
|
||||||
|
ENV BIGCHAINDB_WSSERVER_SCHEME ws
|
||||||
|
|
||||||
|
ENV BIGCHAINDB_WSSERVER_ADVERTISED_HOST 0.0.0.0
|
||||||
|
ENV BIGCHAINDB_WSSERVER_ADVERTISED_SCHEME ws
|
||||||
|
ENV BIGCHAINDB_TENDERMINT_PORT 26657
|
||||||
|
|
||||||
|
VOLUME /data/db /data/configdb /tendermint
|
||||||
|
|
||||||
|
EXPOSE 27017 28017 9984 9985 26656 26657 26658
|
||||||
|
|
||||||
|
COPY pkg/scripts/all-in-one.bash /usr/src/app/
|
||||||
|
WORKDIR $HOME
|
||||||
|
ENTRYPOINT ["/usr/src/app/all-in-one.bash"]
|
||||||
12
pkg/scripts/all-in-one.bash
Executable file
12
pkg/scripts/all-in-one.bash
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# MongoDB configuration
|
||||||
|
[ "$(stat -c %U /data/db)" = mongodb ] || chown -R mongodb /data/db
|
||||||
|
nohup mongod > /tmp/mongodb_log_$(date +%Y%m%d_%H%M%S) 2>&1 &
|
||||||
|
|
||||||
|
# Tendermint configuration
|
||||||
|
tendermint init
|
||||||
|
|
||||||
|
# BigchainDB configuration
|
||||||
|
bigchaindb-monit-config
|
||||||
|
monit -d 5 -I -B
|
||||||
@ -93,7 +93,7 @@ case \$1 in
|
|||||||
start_bigchaindb)
|
start_bigchaindb)
|
||||||
|
|
||||||
pushd \$4
|
pushd \$4
|
||||||
nohup bigchaindb start >> \$3/bigchaindb.out.log 2>> \$3/bigchaindb.err.log &
|
nohup bigchaindb -l DEBUG start >> \$3/bigchaindb.out.log 2>> \$3/bigchaindb.err.log &
|
||||||
|
|
||||||
echo \$! > \$2
|
echo \$! > \$2
|
||||||
popd
|
popd
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user