From 17989a1e635ecbd04e89ba55a0b0623b505536b2 Mon Sep 17 00:00:00 2001 From: Muzahid Date: Fri, 8 Jan 2021 16:12:22 +0530 Subject: [PATCH] add docker composer for multistage build with single file and remove all unwanted files --- docker/bionic-buildenv.docker => Dockerfile | 33 +++++++++++++++++++-- docker-compose.yml | 13 ++++++++ docker/bionic-travis.docker | 16 ---------- docker/bionic-wine.docker | 33 --------------------- 4 files changed, 43 insertions(+), 52 deletions(-) rename docker/bionic-buildenv.docker => Dockerfile (65%) create mode 100644 docker-compose.yml delete mode 100644 docker/bionic-travis.docker delete mode 100644 docker/bionic-wine.docker diff --git a/docker/bionic-buildenv.docker b/Dockerfile similarity index 65% rename from docker/bionic-buildenv.docker rename to Dockerfile index e7f02f2..b70dbd3 100644 --- a/docker/bionic-buildenv.docker +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM ubuntu:bionic + +FROM ubuntu:bionic AS pybm-build ENV DEBIAN_FRONTEND noninteractive @@ -6,13 +7,15 @@ RUN dpkg --add-architecture i386 RUN apt-get update +RUN apt-get -y install sudo + # travis xenial bionic RUN apt-get install -yq --no-install-suggests --no-install-recommends \ - python-setuptools libssl-dev python-dev python-virtualenv python-pip + python-setuptools libssl-dev libpq-dev python-prctl python-dev python-dev python-virtualenv python-pip # travis focal RUN apt-get install -yq --no-install-suggests --no-install-recommends \ - python-setuptools libssl-dev python-dev python3-virtualenv python3-pip + python-setuptools libpcap-dev libpq-dev python-prctl python-dev libpcap-dev python3-virtualenv python3-pip # dpkg RUN apt-get install -yq --no-install-suggests --no-install-recommends \ @@ -46,3 +49,27 @@ RUN useradd -ms /bin/bash pool RUN echo 'pool ALL=ALL NOPASSWD:ALL' >> /etc/sudoers + +## pybm-travis + +FROM pybm-build AS buildbot-test + +RUN pip install --upgrade setuptools + +ENV HOME /root + +WORKDIR $HOME + +RUN git clone https://github.com/Bitmessage/PyBitmessage + +RUN apt-get -y install python-prctl g++ + +WORKDIR $HOME/PyBitmessage +ENV PATH $HOME/.local/bin:$PATH + +RUN pip install -r requirements.txt +RUN ln -s src pybitmessage +RUN python setup.py install --user +RUN python checkdeps.py +RUN xvfb-run src/bitmessagemain.py -t +RUN python setup.py test diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3d47e03 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: "3.4" +services: + pybm-build: + image: pybm-build + build: + dockerfile: Dockerfile + context: . + buildbot-test: + image: buildbot-test + build: + dockerfile: Dockerfile + context: . + target: pybm-build diff --git a/docker/bionic-travis.docker b/docker/bionic-travis.docker deleted file mode 100644 index 7a3a543..0000000 --- a/docker/bionic-travis.docker +++ /dev/null @@ -1,16 +0,0 @@ -FROM pybm-build - -USER pool - -WORKDIR $HOME -RUN git clone https://github.com/Bitmessage/PyBitmessage - -WORKDIR $HOME/PyBitmessage -ENV PATH $HOME/.local/bin:$PATH - -RUN pip install -r requirements.txt -RUN ln -s src pybitmessage -RUN python setup.py install --user -RUN python checkdeps.py -RUN xvfb-run src/bitmessagemain.py -t -RUN python setup.py test diff --git a/docker/bionic-wine.docker b/docker/bionic-wine.docker deleted file mode 100644 index 3928476..0000000 --- a/docker/bionic-wine.docker +++ /dev/null @@ -1,33 +0,0 @@ -FROM pybm-build - -USER pool - - -RUN mkdir $HOME/Downloads -WORKDIR $HOME/Downloads -RUN wget https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi - -WORKDIR $HOME -RUN git clone https://github.com/Bitmessage/PyBitmessage - -WORKDIR $HOME/PyBitmessage -ENV PATH $HOME/.local/bin:$PATH -RUN ln -s src pybitmessage - -# 64b -RUN xvfb-run buildscripts/winbuild.sh -ENV WINEPREFIX $HOME/.wine64 -ENV WINEARCH=win64 -RUN xvfb-run wine msiexec -i $HOME/Downloads/VCForPython27.msi /q /norestart -RUN xvfb-run winetricks -q dotnet40 -RUN xvfb-run wine pip install wheel -RUN xvfb-run wine python setup.py test - -# 32b -RUN xvfb-run i386 buildscripts/winbuild.sh -ENV WINEPREFIX $HOME/.wine32 -ENV WINEARCH=wine32 -RUN xvfb-run i386 wine msiexec -i $HOME/Downloads/VCForPython27.msi /q /norestart -RUN xvfb-run i386 winetricks -q dotnet40 -RUN xvfb-run i386 wine pip install wheel -RUN xvfb-run i386 wine python setup.py test