add run.sh CMD in Dockerfile
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# A container for PyBitmessage daemon
|
||||
FROM ubuntu:bionic-20220401
|
||||
FROM ubuntu:bionic
|
||||
|
||||
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
|
||||
|
||||
@@ -11,10 +11,8 @@ RUN apt-get install -yq --no-install-suggests --no-install-recommends \
|
||||
python-all-dev python-msgpack python-pip python-setuptools \
|
||||
git
|
||||
|
||||
WORKDIR /root
|
||||
RUN git clone https://github.com/Bitmessage/PyBitmessage
|
||||
|
||||
WORKDIR /root/PyBitmessage
|
||||
RUN git clone https://github.com/Bitmessage/PyBitmessage .
|
||||
|
||||
# Install
|
||||
RUN pip2 install jsonrpclib .
|
||||
@@ -23,20 +21,15 @@ FROM ubuntu:bionic-20220401
|
||||
|
||||
EXPOSE 8442
|
||||
|
||||
ENV BITMESSAGE_API_USER=bitmessage_api_user
|
||||
ENV BITMESSAGE_API_PASSWORD=bitmessage_api_password
|
||||
ENV BITMESSAGE_SEED_PHRASE=bitmessage_seed_phrase
|
||||
ENV BITMESSAGE_SEED_ADDRESSES=1
|
||||
ENV BITMESSAGE_API_PORT=8442
|
||||
ENV BITMESSAGE_TTL=172800
|
||||
ENV BITMESSAGE_STOPRESENDINGAFTERXDAYS=30
|
||||
|
||||
ENV USER_UID=2000
|
||||
ENV USER_GID=2000
|
||||
ENV HOME=/home/bitmessage
|
||||
ENV BITMESSAGE_HOME=${HOME}
|
||||
|
||||
COPY --from=0 /usr/local/ /usr/local/
|
||||
COPY --from=0 /root/PyBitmessage/docker/healthy_check.py /usr/local/bin/
|
||||
COPY --from=0 /root/PyBitmessage/docker/seed_addr_gen.py /usr/local/bin/
|
||||
COPY --from=0 /root/PyBitmessage/docker/run.sh /usr/local/bin/
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
@@ -45,29 +38,16 @@ RUN apt-get update \
|
||||
|
||||
# Create a user
|
||||
RUN addgroup --gid $USER_GID bitmessage ;\
|
||||
useradd --uid $USER_UID --gid $USER_GID -m -d $HOME bitmessage
|
||||
useradd --uid $USER_UID --gid $USER_GID --skel /dev/null --create-home --home-dir $HOME bitmessage
|
||||
|
||||
WORKDIR ${HOME}
|
||||
|
||||
# Generate default config
|
||||
RUN su bitmessage -c "pybitmessage -t"
|
||||
|
||||
# Setup environment
|
||||
CMD chown bitmessage:bitmessage keys.dat; chmod 600 keys.dat; \
|
||||
cat keys.dat | \
|
||||
sed -e "s|\(apiinterface = \).*|\10\.0\.0\.0|g" \
|
||||
#-e "s|\(apivariant = \).*|\1json|g" \
|
||||
-e "s|\(apiusername = \).*|\1$BITMESSAGE_API_USER|g" \
|
||||
-e "s|\(apipassword = \).*|\1$BITMESSAGE_API_PASSWORD|g" \
|
||||
-e "s|\(apiport = \).*|\1$BITMESSAGE_API_PORT|g" \
|
||||
-e "s|\(apienabled = \).*|\1True|g" \
|
||||
-e "s|\(ttl = \).*|\1$BITMESSAGE_TTL|g" \
|
||||
-e "s|\(stopresendingafterxdays = \).*|\1$BITMESSAGE_STOPRESENDINGAFTERXDAYS|g" \
|
||||
-e "s|\(udp = \).*|\1False|g" | \
|
||||
gosu bitmessage sponge keys.dat && \
|
||||
exec gosu bitmessage nice -n 19 pybitmessage -d
|
||||
CMD ["sh", "/usr/local/bin/run.sh"]
|
||||
|
||||
# Generate Deterministic address
|
||||
HEALTHCHECK --retries=3 --interval=15s \
|
||||
CMD python -c "import xmlrpclib; api_link='http://$BITMESSAGE_API_USER:$BITMESSAGE_API_PASSWORD@127.0.0.1:8442/'; api = xmlrpclib.ServerProxy(api_link); print api.createDeterministicAddresses('$BITMESSAGE_SEED_PHRASE'.encode('base64'),$BITMESSAGE_SEED_ADDRESSES)" || exit 1
|
||||
## Check PyBitmessage active network connections
|
||||
HEALTHCHECK --retries=0 --interval=15s \
|
||||
CMD ["python", "/usr/local/bin/healthy_check.py"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user