Various Dockerfile improvements
- installs cutting edge version from current source - removes outdated java version fixes - migrates to host Python3 - verifies the image builds and run via Travis - fixes minor linting: "E117 over-indented"
This commit is contained in:
parent
71aae60e31
commit
366aff9c60
4 changed files with 32 additions and 31 deletions
26
.travis.yml
26
.travis.yml
|
@ -1,11 +1,23 @@
|
||||||
sudo: false
|
sudo: required
|
||||||
|
|
||||||
language: python
|
language: generic
|
||||||
|
|
||||||
python:
|
services:
|
||||||
- "2.7"
|
- docker
|
||||||
- "3.6"
|
|
||||||
|
|
||||||
install: pip install tox-travis
|
before_install:
|
||||||
|
- travis_retry sudo apt update -qq
|
||||||
|
- travis_retry sudo apt install -qq --no-install-recommends python2.7 python3
|
||||||
|
- sudo pip install tox>=2.0
|
||||||
|
# https://github.com/travis-ci/travis-ci/issues/6069#issuecomment-266546552
|
||||||
|
- git remote set-branches --add origin master
|
||||||
|
- git fetch
|
||||||
|
|
||||||
script: tox
|
before_script:
|
||||||
|
# we want to fail fast on tox errors without having to `docker build` first
|
||||||
|
- tox
|
||||||
|
|
||||||
|
script:
|
||||||
|
# simply makes sure the Docker image builds and run
|
||||||
|
- docker build --tag=buildozer .
|
||||||
|
- docker run buildozer --version
|
||||||
|
|
25
Dockerfile
25
Dockerfile
|
@ -2,9 +2,6 @@
|
||||||
# Build with:
|
# Build with:
|
||||||
# docker build --tag=buildozer .
|
# docker build --tag=buildozer .
|
||||||
#
|
#
|
||||||
# if you want to use bleeding edge/current version from git, instead from pypi, then use
|
|
||||||
# docker build --tag=buildozer --build-arg git=true .
|
|
||||||
#
|
|
||||||
# In order to give the container access to your current working directory
|
# In order to give the container access to your current working directory
|
||||||
# it must be mounted using the --volume option.
|
# it must be mounted using the --volume option.
|
||||||
# Run with (e.g. `buildozer --version`):
|
# Run with (e.g. `buildozer --version`):
|
||||||
|
@ -13,17 +10,13 @@
|
||||||
# docker run --volume "$(pwd)":/home/user/hostcwd --entrypoint /bin/bash -it --rm buildozer
|
# docker run --volume "$(pwd)":/home/user/hostcwd --entrypoint /bin/bash -it --rm buildozer
|
||||||
|
|
||||||
FROM ubuntu:18.04
|
FROM ubuntu:18.04
|
||||||
ARG git
|
|
||||||
|
|
||||||
ENV BDOZER_REQ=${git:+"/src"}
|
|
||||||
ENV BDOZER_REQ=${BDOZER_REQ:-"buildozer"}
|
|
||||||
ENV USER="user"
|
ENV USER="user"
|
||||||
ENV HOME_DIR="/home/${USER}"
|
ENV HOME_DIR="/home/${USER}"
|
||||||
ENV WORK_DIR="${HOME_DIR}/hostcwd" \
|
ENV WORK_DIR="${HOME_DIR}/hostcwd" \
|
||||||
|
SRC_DIR="${HOME_DIR}/src" \
|
||||||
PATH="${HOME_DIR}/.local/bin:${PATH}"
|
PATH="${HOME_DIR}/.local/bin:${PATH}"
|
||||||
|
|
||||||
COPY . /src
|
|
||||||
|
|
||||||
# configures locale
|
# configures locale
|
||||||
RUN apt update -qq > /dev/null && \
|
RUN apt update -qq > /dev/null && \
|
||||||
apt install -qq --yes --no-install-recommends \
|
apt install -qq --yes --no-install-recommends \
|
||||||
|
@ -35,14 +28,14 @@ ENV LANG="en_US.UTF-8" \
|
||||||
|
|
||||||
# installs system dependencies (required to setup all the tools)
|
# installs system dependencies (required to setup all the tools)
|
||||||
RUN apt install -qq --yes --no-install-recommends \
|
RUN apt install -qq --yes --no-install-recommends \
|
||||||
sudo python-pip python-setuptools file
|
sudo python3-pip python3-setuptools file
|
||||||
|
|
||||||
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-18-04-64bit
|
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-18-04-64bit
|
||||||
RUN dpkg --add-architecture i386 && apt update -qq > /dev/null && \
|
RUN dpkg --add-architecture i386 && apt update -qq > /dev/null && \
|
||||||
apt install -qq --yes --no-install-recommends \
|
apt install -qq --yes --no-install-recommends \
|
||||||
build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
|
build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
|
||||||
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 \
|
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python3 \
|
||||||
python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
|
python3-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
|
||||||
|
|
||||||
# prepares non root env
|
# prepares non root env
|
||||||
RUN useradd --create-home --shell /bin/bash ${USER}
|
RUN useradd --create-home --shell /bin/bash ${USER}
|
||||||
|
@ -52,15 +45,9 @@ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||||
|
|
||||||
USER ${USER}
|
USER ${USER}
|
||||||
WORKDIR ${WORK_DIR}
|
WORKDIR ${WORK_DIR}
|
||||||
|
COPY --chown=user:user . ${SRC_DIR}
|
||||||
|
|
||||||
# installs buildozer and dependencies
|
# installs buildozer and dependencies
|
||||||
RUN pip install --user Cython==0.25.2 $BDOZER_REQ
|
RUN pip3 install --user Cython==0.28.6 ${SRC_DIR}
|
||||||
|
|
||||||
# calling buildozer adb command should trigger SDK/NDK first install and update
|
|
||||||
# but it requires a buildozer.spec file
|
|
||||||
RUN cd /tmp/ && buildozer init && buildozer android adb -- version && cd -
|
|
||||||
# fixes source and target JDK version, refs https://github.com/kivy/buildozer/issues/625
|
|
||||||
RUN sed s/'name="java.source" value="1.5"'/'name="java.source" value="7"'/ -i ${HOME_DIR}/.buildozer/android/platform/android-sdk-20/tools/ant/build.xml
|
|
||||||
RUN sed s/'name="java.target" value="1.5"'/'name="java.target" value="7"'/ -i ${HOME_DIR}/.buildozer/android/platform/android-sdk-20/tools/ant/build.xml
|
|
||||||
|
|
||||||
ENTRYPOINT ["buildozer"]
|
ENTRYPOINT ["buildozer"]
|
||||||
|
|
|
@ -510,10 +510,12 @@ class Buildozer(object):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
# did we already installed the libs ?
|
# did we already installed the libs ?
|
||||||
if exists(self.applibs_dir) and \
|
if (
|
||||||
self.state.get('cache.applibs', '') == requirements:
|
exists(self.applibs_dir) and
|
||||||
self.debug('Application requirements already installed, pass')
|
self.state.get('cache.applibs', '') == requirements
|
||||||
return
|
):
|
||||||
|
self.debug('Application requirements already installed, pass')
|
||||||
|
return
|
||||||
|
|
||||||
# recreate applibs
|
# recreate applibs
|
||||||
self.rmdir(self.applibs_dir)
|
self.rmdir(self.applibs_dir)
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -1,5 +1,5 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = pep8,py27,py36
|
envlist = pep8,py27,py3
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps = mock
|
deps = mock
|
||||||
|
|
Loading…
Reference in a new issue