diff --git a/docker/scripts/do-build.sh b/docker/scripts/do-build.sh new file mode 100755 index 00000000..85e238e7 --- /dev/null +++ b/docker/scripts/do-build.sh @@ -0,0 +1,90 @@ +#!/bin/bash +#-------------------------------------------------------------------------- +# This script is run in the Docker containers performs the actual build of +# Phoenix. It expects to find a source tarball in ../../dist, (which is +# mapped to ~/dist in the container). +#-------------------------------------------------------------------------- +set -o errexit + +# This is the name of the virtual environment to be built. They should all be +# named like Py27, Py35, etc. If "all" is given then all the environments in +# ~/venvs will be used for a build. +PYENV=$1 +if [ "$PYENV" == "" ]; then + PYENV=all +fi + +# Either "gtk2", "gtk3" or "all" +PORT=$2 +if [ "$PORT" == "" ]; then + PORT=all +fi + +TARBALL=$(ls ~/dist/wxPython-*.tar.gz) +if [ "$TARBALL" == "" ]; then + echo "ERROR: Source tarball not found." + exit 1 +fi + + +# This function is called to do each build. +# It is given the Python virtualenv to be used, a tag (gtk2 or gtk3) to be +# used to help name the target folder, and an optional flag (--gtk3) to be +# passed on the build.py command line. +function do_build { + VENV=$1 + TAG=$2 + FLAG=$3 + + rm -rf ~/wxPython-* + + # setup + echo "**** do_build $VENV $TAG $FLAG ****" + echo "Using Python from VENV $VENV" + ORIG_PATH=$PATH + export PATH=$VENV/bin:$PATH + echo PYTHON: $(which python) + echo $(python -c "import sys; print(sys.version)") + + echo "Unpacking source archive..." + tar xzf $TARBALL + + # move into the source tree + cd ~/wxPython-* + + # update packages + pip install -U pip + pip install -U -r requirements.txt + + # Build wxWidgets, Phoenix and a Wheel + # Since we're using a source tarball we don't need to do all the code + # generation parts, all files should already be present + python build.py $FLAG build_wx build_py bdist_wheel + + # copy the results back to the host's shared dist folder + WXPYVER=$(python -c "import buildtools; buildtools.printVersion()") + DEST=~/dist/linux/$TAG/$DIST_NAME + mkdir -p $DEST + mv dist/*.whl $DEST + + # clean up + cd ~ + rm -rf ~/wxPython-* + export PATH=$ORIG_PATH +} + + +# Do a build for each Python virtual environment in ~/venvs +for VENV in ~/venvs/*; do + if [ $PYENV = all -o $PYENV = $(basename $VENV) ]; then + # build a package for GTK2? + if [ $PORT = all -o $PORT = gtk2 ]; then + do_build $VENV gtk2 --gtk2 + fi + # build a package for GTK3? + if [ $PORT = all -o $PORT = gtk3 ]; then + do_build $VENV gtk3 --gtk3 + fi + fi +done + diff --git a/docker/scripts/hello.sh b/docker/scripts/hello.sh new file mode 100755 index 00000000..9f1ed4c9 --- /dev/null +++ b/docker/scripts/hello.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo Hello World diff --git a/docker/ubuntu-18.04/Dockerfile b/docker/ubuntu-18.04/Dockerfile index 2c28710a..d662bb3e 100644 --- a/docker/ubuntu-18.04/Dockerfile +++ b/docker/ubuntu-18.04/Dockerfile @@ -3,43 +3,67 @@ FROM ubuntu:18.04 # Set environment variables -ENV HOME /root +ENV DIST_NAME=ubuntu-18.04 +ENV USE_DEADSNAKES=no +ENV USER=wxpy +ENV HOME=/home/$USER +ENV PYTHONUNBUFFERED=1 +ENV PATH=$HOME/bin:$PATH -# Define working directory -WORKDIR $HOME - - -# Install packages and setup environments +# Update and install basic OS packages RUN \ -## add-apt-repository ppa:deadsnakes/ppa ## Not yet available for bionic - apt update && \ - apt install -y build-essential dpkg-dev && \ - apt install -y libgtk2.0-dev libgtk-3-dev && \ - apt install -y libjpeg-dev libtiff-dev \ - libsdl1.2-dev libgstreamer-plugins-base1.0-dev \ - libnotify-dev freeglut3 freeglut3-dev libsm-dev \ - libwebkitgtk-dev libwebkitgtk-3.0-dev && \ - \ -# Install all available Python packages and their dev packages, and create some virtualenvs - apt install -y python2.7 python2.7-dev libpython2.7-dev python-virtualenv && \ - apt install -y python3.6 python3.6-dev libpython3.6-dev python3.6-venv && \ - apt install -y python3.7 python3.7-dev libpython3.7-dev python3.7-venv && \ - \ - mkdir $HOME/venvs && \ - cd $HOME && \ - virtualenv --python=python2.7 venvs/Py27 && \ - python3.6 -m venv venvs/Py36 && \ - python3.7 -m venv venvs/Py37 && \ - echo "Done with setup" + adduser --disabled-password --gecos "" ${USER}; \ + apt-get update; \ + apt-get upgrade -y; \ + apt-get install -y \ + apt-utils \ + build-essential \ + software-properties-common; \ +# Install development packages needed for building wxPython + apt-get install -y \ + freeglut3 \ + freeglut3-dev \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ + libgstreamer-plugins-base1.0-dev \ + libgtk-3-dev \ + libgtk2.0-dev \ + libjpeg-dev \ + libnotify-dev \ + libsdl2-dev \ + libsm-dev \ + libtiff-dev \ + libwebkit2gtk-4.0-dev \ + libwebkitgtk-dev \ + libxtst-dev; \ + apt-get clean; +# Install all available Python packages and their dev packages +RUN \ + if [ ${USE_DEADSNAKES} = yes ]; then add-apt-repository ppa:deadsnakes/ppa; apt-get update; fi; \ + apt-get install -y python2.7 python2.7-dev libpython2.7-dev python-virtualenv; \ + apt-get install -y python3.6 python3.6-dev libpython3.6-dev python3.6-venv; \ + apt-get install -y python3.7 python3.7-dev libpython3.7-dev python3.7-venv; \ + apt-get clean; + +# Set the user and group to use for the rest of the commands +USER ${USER}:${USER} + +# Set the working directory +WORKDIR ${HOME} + +# Create virtual environments for each Python +RUN \ + cd ${HOME}; \ + mkdir -p ${HOME}/venvs; \ + mkdir -p ${HOME}/dist; \ + virtualenv --python=python2.7 venvs/Py27; \ + python3.6 -m venv venvs/Py36; \ + python3.7 -m venv venvs/Py37; # Add files from host into the container -# ... ??? - - -# Define moiunt-points for shared folders -VOLUME $HOME/dist +COPY scripts ${HOME}/bin # Define default command -CMD ["bash"] +CMD ["/bin/bash", "-l"]