## syntax=docker/dockerfile:3 ## BitDeals Module Dockerfile ## the Module user ARG UNAME="dm" ARG UHOME="/home/$UNAME" ## Base image FROM debian:bullseye AS updated-debian SHELL ["/bin/bash", "-exo", "pipefail", "-c"] LABEL name="BitDeals Module" EXPOSE 4999/tcp 80/tcp 443/tcp ## Debian update; install dependencies ARG DEBIAN_FRONTEND="noninteractive" \ DEBCONF_NOWARNINGS="yes" RUN apt-get update -y ; \ apt-get upgrade -y ; \ apt-get -y install --no-install-recommends locales tzdata jq moreutils; \ apt-get -y install --no-install-recommends gpg gpg-agent ; \ apt-get -y install --no-install-recommends nginx ; \ apt-get -y install --no-install-recommends openssl ca-certificates ; \ apt-get clean ; \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ## Generate UTF-8 locales RUN sed -i '/\.UTF-8/s/^# //g' /etc/locale.gen; \ locale-gen ## Add the Module user ARG UNAME ARG UHOME RUN useradd --create-home --home-dir $UHOME $UNAME FROM updated-debian AS development ## Debian update; install dependencies for: C++ compiler; OpenPGP; Libbitcoin ARG DEBIAN_FRONTEND="noninteractive" \ DEBCONF_NOWARNINGS="yes" RUN apt-get -y update RUN apt-get -y install --no-install-recommends build-essential libssl-dev libcurl4-openssl-dev make cmake gcc g++ git RUN apt-get -y install --no-install-recommends libgmp-dev libbz2-dev libzip-dev RUN apt-get -y install --no-install-recommends autoconf automake libtool pkg-config wget ## Avoid error: "Server Certificate Verification Failed. CRLfile: none" RUN apt-get install -y --reinstall ca-certificates ARG UNAME ARG UHOME ## Install OpenPGP RUN su -l --shell /bin/bash $UNAME -c 'git clone https://github.com/calccrypto/OpenPGP ; \ mkdir OpenPGP/build ; cd OpenPGP/build ; \ sed -i "s/master/v1.12.x/" ../contrib/cmake/GoogleTest.txt.in ; \ cmake -DUSE_OPENSSL=ON -DGPG_COMPATIBLE=ON .. ; \ make' ; \ cd $UHOME/OpenPGP/build/ ; \ make install ## Install Yaml-cpp RUN su -l --shell /bin/bash $UNAME -c 'git clone https://github.com/jbeder/yaml-cpp ; \ mkdir yaml-cpp/build ; cd yaml-cpp/build ; \ cmake .. ; \ make' ; \ cd $UHOME/yaml-cpp/build/ ; \ make install ## Install Libbitcoin explorer RUN su -l --shell /bin/bash $UNAME -c 'wget https://raw.githubusercontent.com/libbitcoin/libbitcoin-explorer/version3/install.sh ; \ chmod +x install.sh' ; \ cd $UHOME ; \ sed -i '/git clone / s/git.*$/while true; do & \&\& break; done/' install.sh ; \ sed -i '/$WGET / s/$WGET.*$/while true; do & \&\& break; done/' install.sh ; \ ./install.sh --verbose --build-boost --build-zmq --disable-shared ## Install BitDeals module (apostol-dm) #cmake -DCMAKE_BUILD_TYPE=Debug . -B cmake-build-debug' ; \ RUN su -l --shell /bin/bash $UNAME -c 'cd '$UHOME' ; \ git clone https://git.bitdeals.org/private/apostol-dm.git ; \ cd apostol-dm ; \ ./configure ; \ cd cmake-build-release ; \ make' ; \ git config --global --add safe.directory $UHOME/apostol-dm ;\ cd $UHOME/apostol-dm/cmake-build-release ;\ make install ## Download "build" directory from web-build repository RUN su -l --shell /bin/bash $UNAME -c 'cd '$UHOME' ; \ mkdir web-build ;\ cd web-build ;\ git init ;\ git remote add -f origin https://git.bitdeals.org/private/web-build/ ;\ echo build >> .git/info/sparse-checkout ;\ git pull origin master' FROM updated-debian ARG UNAME ARG UHOME ENV UNAME=$UNAME ENV UHOME=$UHOME COPY --from=development /usr/local/ /usr/local/ COPY --from=development /etc/dm/ /etc/dm/ COPY --from=development /usr/sbin/dm /usr/sbin/dm COPY --from=development /etc/init.d/dm /etc/init.d/dm COPY --from=development --chown=www-data:www-data $UHOME/web-build/build /var/www/web COPY --from=development --chown=$UNAME:$UNAME $UHOME/apostol-dm/docker/bitdeals-testnet.asc /etc/dm/bitdeals-testnet.asc COPY --from=development --chown=$UNAME:$UNAME $UHOME/apostol-dm/docker/bitdeals.asc /etc/dm/bitdeals.asc COPY --from=development $UHOME/apostol-dm/docker/entrypoint.sh /entrypoint.sh COPY nginx.conf /etc/nginx/sites-enabled/default #dm: error while loading shared libraries: libOpenPGP.so: cannot open shared object file: No such file or directory RUN ldconfig RUN chmod 755 /entrypoint.sh CMD ["/entrypoint.sh"]