Compare commits

...

2 commits

11 changed files with 325 additions and 29 deletions

View file

@ -28,4 +28,18 @@ Additionally, the linux-6*-latex tag include a full TeXlive installation includi
---
## Building docker files
It's recommended to use the `build.sh` bash script to build the Docker image. They use the `config.toml` in each directory to provide the data for each build,
including the specific PySide versions to use for each.
Usage:
`bash build.sh [--pyside2] [--pyside6] [--latest] [--no-push] [--repo=ad5001/ubuntu-pyside-xvfb]`
- --pyside2: Build PySide2 images.
- --pyside6: Build PySide6 images.
- --latest: (Optional) Tag these as latest.
- --no-push: (Optional) Do not push the tags to the Docker registry.
- --repo: (Optional) Repository on the Docker registry which to push the images to.
NOTE: In Docker, use xvfb-run to run a program within a Xvfb server.

163
build.sh Normal file
View file

@ -0,0 +1,163 @@
#!/bin/bash
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# shellcheck disable=SC2046
# Resets all ansi codes.
RESET="\e[0m"
# Sets the forground color to light green.
L_GREEN_FG="\e[32m"
# Sets the forground color to red.
RED_FG="\e[38;5;204m"
pyside6=false
pyside2=false
latest=false
push=true
repo="ad5001/ubuntu-pyside-xvfb"
# Display text in a box
# Signature: (<string message>) -> string
box() {
len=${#1}
echo "┌─$(yes ─ | head -$len | tr -d "\n")─┐"
echo "$1"
echo "└─$(yes ─ | head -$len | tr -d "\n")─┘"
}
box-red() {
echo -n -e "$RED_FG"
box "$@"
echo -n -e "$RESET"
}
box-green() {
echo -n -e "$L_GREEN_FG"
box "$@"
echo -n -e "$RESET"
}
# Returns a string of KEY="VALUES" separated by newlines for the corresponding category.
# Signature: (<string source_file>, <string dict_name>) -> string
from-toml-dict() {
if [ -z "$2" ]; then
sed -n -e '1,/\[/ p' "$1" | grep '="'
else
sed -n -e '/\['"$2"']/,/\[/ p' "$1" | grep '="'
fi
}
# Replaces {KEY} by value in given context.
# Signature: stdin+(<string key>, <string value>) -> string
pass-argument() {
while read -r line; do
echo "${line//\{$1\}/$2}"
done
}
# Queries a value from an INI/singular dict TOML into for a given key
# Signature: stdin+(<string key>) -> string
get-value-of() {
while read -r line; do
if [ "${line%=*}" = "$1" ]; then
echo "$line" | cut -d'"' -f 2
return 0
fi
done
}
# Converts arguments from an INI/singular dict TOML file into a list of build args for docker.
# Signature: stdin+(<string repo>, <string pyside_version>) -> string
to-docker-args() {
# Read stdin
out=""
while read -r line; do
key="${line%=*}"
value="$(echo "${line#=*}" | pass-argument REPO "$1" | pass-argument VERSION "$2")"
out="$out--build-arg $key=$value";
done
echo "$out"
}
# Builds a pyside directory (with a config.toml for additional parameters.
# Signature (<string directory>) -> void
build_pyside() {
directory=$1
cfg="$directory/config.toml"
# Query information from config
major=$(from-toml-dict "$cfg" | get-value-of MAJOR_VERSION)
version=$(from-toml-dict "$cfg" | get-value-of PYSIDE_VERSION)
for build in $(from-toml-dict "$cfg" | get-value-of BUILDS); do
# Build each build individidually
tag="$(from-toml-dict "$cfg" "$build.settings" | get-value-of TAG | pass-argument VERSION "$version")"
latest_tag="$(from-toml-dict "$cfg" "$build.settings" | get-value-of TAG | pass-argument VERSION "${major}-latest")"
build_args="$(from-toml-dict "$cfg" "$build.docker-args" | to-docker-args "$repo" "$version")"
box-green "Building image $tag..."
docker build -t "$tag" $build_args "$directory/${build}"
# Tag as latest
if [ "$latest" != "false" ]; then
docker tag "$tag" "$latest_tag"
fi
# Push builds
if [ "$push" != "false" ]; then
if [ "$latest" != "false" ]; then
box-green "Pushing image $repo/$tag and $repo/$latest_tag..."
docker push "$latest_tag"
docker push "$tag"
else
box-green "Pushing image $repo/$tag..."
docker push "$tag"
fi
fi
done
}
# Query arguments
while [ $# -gt 0 ]; do
case "$1" in
--pyside6)
pyside6=true
;;
--pyside2)
pyside2=true
;;
--latest)
latest=true
;;
--no-push)
push=false
;;
--repo=*)
repo="${1#*=}"
;;
*)
box "Error: Invalid argument."
exit 1
esac
shift
done
if [ "$pyside6" = "false" ] && [ "$pyside2" = "false" ]; then
box-red "Must at least either use --pyside2 or --pyside6"
fi
# Build PySide6
if [ "$pyside6" != "false" ]; then
build_pyside "pyside6"
fi
# Build PySide2
if [ "$pyside2" != "false" ]; then
build_pyside "pyside2"
fi

26
pyside2/config.toml Normal file
View file

@ -0,0 +1,26 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
MAJOR_VERSION="5"
PYSIDE_VERSION="5.12.2.1"
BUILDS="linux wine"
[linux.settings]
TAG="linux-{VERSION}"
[wine.settings]
TAG="wine-{VERSION}"
[wine.docker-args]
# Arguments for wine builds
PYTHON_VERSION="3.10.11"
PYINSTALLER_VERSION="6.10.0"

View file

@ -1,16 +1,28 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
FROM ubuntu:jammy
# Jammy uses python3.10 and not 3.12, which is not compatible with PySide2.
ARG DEBIAN_FRONTEND=noninteractive
ARG PYSIDE2_VERSION=5.15.2.1
ARG PYSIDE_VERSION=5.15.2.1
ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install make git rpm dh-python \
xvfb xdotool wmctrl \
xvfb xdotool wmctrl libxcb-cursor0 \
python3 python3-pip python3-stdeb python3-requests python3-packaging python3-pip python3-pytest python3-pytest-cov python3-pytestqt \
qml-module-qtquick-controls2 qml-module-qtmultimedia qml-module-qtgraphicaleffects qml-module-qtquick2 qml-module-qtqml-models2 qml-module-qtquick-controls
RUN python3 -m pip install -U pip py certifi setuptools wheel # Upgrading packages that need fixes.
RUN python3 -m pip install PySide2==$PYSIDE2_VERSION
RUN python3 -m pip install PySide2==$PYSIDE_VERSION
RUN apt clean

View file

@ -1,6 +1,18 @@
#
# Copyright (c) 2021-2024 Ad5001, 2016 Chris R
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
FROM ubuntu:noble
ARG PYSIDE2_VERSION=5.15.2.1
ARG PYSIDE_VERSION=5.15.2.1
# Adapted from https://github.com/cdrx/docker-pyinstaller/blob/master/Dockerfile-py3-win64
# Upstream hasn't been updated for a while.
@ -9,7 +21,7 @@ ENV DEBIAN_FRONTEND noninteractive
ARG WINE_VERSION=winehq-staging
ARG PYTHON_VERSION=3.10.11 # Python3.10 are the last supported version of Python for PySide2.
ARG PYINSTALLER_VERSION=5.0.1
ARG PYINSTALLER_VERSION=6.10.0
# we need wine for this all to work, so we'll use the PPA
RUN set -x \
@ -78,4 +90,4 @@ RUN set -x \
RUN apt install -y wget curl p7zip-full git unzip nsis xvfb xdotool wmctrl
RUN apt clean
# Installing pyside2 & pyinstaller
RUN pip install wheel PySide2==$PYSIDE2_VERSION pyinstaller==$PYINSTALLER_VERSION requests pytest pytest-cov pytest-qt packaging
RUN pip install wheel PySide2==$PYSIDE_VERSION pyinstaller==$PYINSTALLER_VERSION requests pytest pytest-cov pytest-qt packaging

View file

@ -1,6 +0,0 @@
FROM ad5001/ubuntu-pyside-xvfb:linux-6.7.2
ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get -y install texlive-base dvipng texlive-latex-extra
RUN apt clean

View file

@ -1,15 +0,0 @@
FROM ubuntu:noble
ARG DEBIAN_FRONTEND=noninteractive
ARG PYSIDE2_VERSION=6.7.2
ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install make git rpm dh-python \
xvfb xdotool wmctrl \
python3 python3-pip python3-stdeb python3-requests python3-packaging python3-pip python3-pytest python3-pytest-cov python3-pytestqt
RUN rm /usr/lib/python3.*/EXTERNALLY-MANAGED # Disable managed environment. We don't care about breaking system packages here.
RUN python3 -m pip install -U setuptools # Upgrading packages that need fixes.
RUN python3 -m pip install PySide6==$PYSIDE2_VERSION
RUN apt clean

32
pyside6/config.toml Normal file
View file

@ -0,0 +1,32 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
MAJOR_VERSION="6"
PYSIDE_VERSION="6.7.2"
BUILDS="linux wine linux-latex"
[linux.settings]
TAG="linux-{VERSION}"
[wine.settings]
TAG="wine-{VERSION}"
[linux-latex.settings]
TAG="linux-{VERSION}-latex"
[wine.docker-args]
# Arguments for wine builds
PYTHON_VERSION="3.12.6"
PYINSTALLER_VERSION="6.10.0"
[linux-latex.docker-args]
BASE_IMAGE="{REPO}:linux-{VERSION}"

View file

@ -0,0 +1,20 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
ARG BASE_IMAGE=ad5001/ubuntu-pyside-xvfb:linux-6-latest
FROM ${BASE_IMAGE}
ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get -y install texlive-base dvipng texlive-latex-extra
RUN apt clean

26
pyside6/linux/Dockerfile Normal file
View file

@ -0,0 +1,26 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
FROM ubuntu:noble
ARG DEBIAN_FRONTEND=noninteractive
ARG PYSIDE_VERSION=6.7.2
ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install make git rpm dh-python \
xvfb xdotool wmctrl libxcb-cursor0 \
python3 python3-pip python3-stdeb python3-requests python3-packaging python3-pip python3-pytest python3-pytest-cov python3-pytestqt
RUN rm /usr/lib/python3.*/EXTERNALLY-MANAGED # Disable managed environment. We don't care about breaking system packages here.
RUN python3 -m pip install -U setuptools # Upgrading packages that need fixes.
RUN python3 -m pip install PySide6==$PYSIDE_VERSION
RUN apt clean

View file

@ -1,6 +1,18 @@
#
# Copyright (c) 2021-2024 Ad5001, 2016 Chris R
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
FROM ubuntu:noble
ARG PYSIDE2_VERSION=6.7.2
ARG PYSIDE_VERSION=6.7.2
# Adapted from https://github.com/cdrx/docker-pyinstaller/blob/master/Dockerfile-py3-win64
# Upstream hasn't been updated for a while.
@ -78,4 +90,4 @@ RUN set -x \
RUN apt install -y wget curl p7zip-full git unzip nsis xvfb xdotool wmctrl
RUN apt clean
# Installing pyside6 & pyinstaller
RUN pip install wheel PySide6==$PYSIDE2_VERSION pyinstaller==$PYINSTALLER_VERSION requests pytest pytest-cov pytest-qt packaging
RUN pip install wheel PySide6==$PYSIDE_VERSION pyinstaller==$PYINSTALLER_VERSION requests pytest pytest-cov pytest-qt packaging