Rewrite Dockerfile.bionic:

- install needed dependencies separately in each stage
  - make appimage the first stage because it needs minimum packages
  - replace travis2bash by tox
This commit is contained in:
Lee Miller 2022-04-05 02:20:52 +03:00
parent 60fd56748f
commit 4b8d04c420
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -1,61 +1,48 @@
FROM ubuntu:bionic AS base
ENV DEBIAN_FRONTEND noninteractive
ENV TRAVIS_SKIP_APT_UPDATE 1
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt-get update
# Common apt packages
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
software-properties-common
software-properties-common build-essential libcap-dev libssl-dev \
python-all-dev python-setuptools wget xvfb
RUN dpkg --add-architecture i386
###############################################################################
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get -y install sudo
FROM base AS appimage
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
# travis xenial bionic
python-setuptools libssl-dev python-prctl \
python-dev python-virtualenv python-pip virtualenv \
# dpkg
python-minimal python-all python openssl libssl-dev \
dh-apparmor debhelper dh-python python-msgpack python-qt4 git python-stdeb \
python-all-dev python-crypto python-psutil \
fakeroot python-pytest python3-wheel \
# Code quality
pylint python-pycodestyle python3-pycodestyle pycodestyle python-flake8 \
python3-flake8 flake8 python-pyflakes python3-pyflakes pyflakes pyflakes3 \
curl \
# Wine
python python-pip wget wine-stable winetricks mingw-w64 wine32 wine64 xvfb \
# Buildbot
python3-dev libffi-dev python3-setuptools \
python3-pip \
# python 3.7
python3.7 python3.7-dev \
# .travis.yml
build-essential libcap-dev tor \
language-pack-en
debhelper dh-apparmor dh-python python-stdeb fakeroot
COPY . /home/builder/src
# cleanup
RUN rm -rf /var/lib/apt/lists/*
WORKDIR /home/builder/src
#####################################################################################################
RUN VERSION=$(python setup.py -V) \
&& python setup.py sdist \
&& python setup.py --command-packages=stdeb.command bdist_deb \
&& dpkg-deb -I deb_dist/pybitmessage_${VERSION}-1_amd64.deb
FROM base AS travis
RUN buildscripts/appimage.sh
RUN VERSION=$(python setup.py -V) \
&& out/PyBitmessage-${VERSION}.glibc2.15-x86_64.AppImage \
--appimage-extract-and-run -t
# travis2bash
RUN wget -O /usr/local/bin/travis2bash.sh https://git.bitmessage.org/Bitmessage/buildbot-scripts/raw/branch/master/travis2bash.sh
RUN chmod +x /usr/local/bin/travis2bash.sh
###############################################################################
FROM base AS tox
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
language-pack-en \
libffi-dev python3-dev python3-pip python3.8 python3.8-dev python3.8-venv \
python-msgpack python-pip python-qt4 python-six qt5dxcb-plugin tor
RUN python3.8 -m pip install setuptools wheel
RUN python3.8 -m pip install --upgrade pip tox virtualenv
RUN useradd -m -U builder
RUN echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# copy sources
COPY . /home/builder/src
@ -63,14 +50,21 @@ RUN chown -R builder.builder /home/builder/src
USER builder
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
WORKDIR /home/builder/src
ENTRYPOINT /usr/local/bin/travis2bash.sh
ENTRYPOINT ["tox"]
#####################################################################################################
###############################################################################
FROM base AS buildbot
# cleanup
RUN rm -rf /var/lib/apt/lists/*
# travis2bash
RUN wget -O /usr/local/bin/travis2bash.sh https://git.bitmessage.org/Bitmessage/buildbot-scripts/raw/branch/master/travis2bash.sh
RUN chmod +x /usr/local/bin/travis2bash.sh
@ -86,22 +80,7 @@ USER buildbot
ENTRYPOINT /entrypoint.sh "$BUILDMASTER" "$WORKERNAME" "$WORKERPASS"
#################################################################################################
FROM base AS appimage
COPY . /home/builder/src
WORKDIR /home/builder/src
RUN VERSION=$(python setup.py -V) \
&& python setup.py sdist \
&& python setup.py --command-packages=stdeb.command bdist_deb \
&& dpkg-deb -I deb_dist/pybitmessage_${VERSION}-1_amd64.deb
RUN buildscripts/appimage.sh
RUN VERSION=$(python setup.py -V) \
&& out/PyBitmessage-${VERSION}.glibc2.15-x86_64.AppImage --appimage-extract-and-run -t
###############################################################################
FROM base AS appandroid