Make a separate script launcher.sh for the entry point, it allows
- passing args to the pybitmessage - setting API username and password through env
This commit is contained in:
parent
8a9899c9df
commit
3b060d84b9
12
Dockerfile
12
Dockerfile
|
@ -16,6 +16,7 @@ ENV BITMESSAGE_HOME ${HOME}
|
|||
|
||||
WORKDIR ${HOME}
|
||||
ADD . ${HOME}
|
||||
COPY packages/docker/launcher.sh /usr/bin/
|
||||
|
||||
# Install
|
||||
RUN pip2 install jsonrpclib .
|
||||
|
@ -32,12 +33,5 @@ USER bitmessage
|
|||
# Generate default config
|
||||
RUN pybitmessage -t
|
||||
|
||||
# Setup environment
|
||||
RUN APIPASS=$(tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo) \
|
||||
&& echo "\napiusername: api\napipassword: $APIPASS" \
|
||||
&& sed -ie "s|\(apiinterface = \).*|\10\.0\.0\.0|g" keys.dat \
|
||||
&& sed -ie "s|\(apivariant = \).*|\1json|g" keys.dat \
|
||||
&& sed -ie "s|\(apiusername = \).*|\1api|g" keys.dat \
|
||||
&& sed -ie "s|\(apipassword = \).*|\1$APIPASS|g" keys.dat
|
||||
|
||||
CMD ["pybitmessage", "-d"]
|
||||
ENTRYPOINT ["launcher.sh"]
|
||||
CMD ["-d"]
|
||||
|
|
16
packages/docker/launcher.sh
Executable file
16
packages/docker/launcher.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Setup the environment for docker container
|
||||
APIUSER=${USER:-api}
|
||||
APIPASS=${PASSWORD:-$(tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo)}
|
||||
|
||||
echo "\napiusername: $APIUSER\napipassword: $APIPASS"
|
||||
|
||||
sed -i -e "s|\(apiinterface = \).*|\10\.0\.0\.0|g" \
|
||||
-e "s|\(apivariant = \).*|\1json|g" \
|
||||
-e "s|\(apiusername = \).*|\1$APIUSER|g" \
|
||||
-e "s|\(apipassword = \).*|\1$APIPASS|g" \
|
||||
-e "s|apinotifypath = .*||g" ${BITMESSAGE_HOME}/keys.dat
|
||||
|
||||
# Run
|
||||
exec pybitmessage "$@"
|
Reference in New Issue
Block a user