From bf370e9127ade364230eec5db8b0e4f6dd64e6a3 Mon Sep 17 00:00:00 2001
From: Alberto Nidasio <nidasioalberto@gmail.com>
Date: Fri, 12 Jul 2024 13:58:10 +0200
Subject: [PATCH] Split docker files into Linux and Windows and updated the
 pipeline

---
 .gitlab-ci.yml    | 19 ++++++++---
 Dockerfile        | 84 -----------------------------------------------
 DockerfileLinux   | 52 +++++++++++++++++++++++++++++
 DockerfileWindows | 62 ++++++++++++++++++++++++++++++++++
 4 files changed, 129 insertions(+), 88 deletions(-)
 delete mode 100644 Dockerfile
 create mode 100644 DockerfileLinux
 create mode 100644 DockerfileWindows

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d9e7574..f839d12 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,13 +4,24 @@ variables:
 stages:
   - docker
 
-docker:
+linux:
   stage: docker
   image: docker
   tags:
     - docker
   script:
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-    - docker build -t $CI_REGISTRY_IMAGE:latest .
-    - docker push $CI_REGISTRY_IMAGE:latest
-  timeout: 12 hours
\ No newline at end of file
+    - docker build --file DockerfileLinux --progress=plain -t $CI_REGISTRY/avn/swd/docker/qt/linux:latest .
+    - docker push $CI_REGISTRY/avn/swd/docker/qt/linux:latest
+  timeout: 12 hours
+
+windows:
+  stage: docker
+  image: docker
+  tags:
+    - docker
+  script:
+    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+    - docker build --file DockerfileWindows --progress=plain -t $CI_REGISTRY/avn/swd/docker/qt/windows:latest .
+    - docker push $CI_REGISTRY/avn/swd/docker/qt/windows:latest
+  timeout: 12 hours
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 9707cb8..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,84 +0,0 @@
-FROM ubuntu:22.04
-
-# Update apt cache
-RUN apt-get update
-
-# Install base dependencies
-RUN apt-get install -y python3 
-RUN apt-get install -y python3-pip
-RUN apt-get install -y git
-RUN apt-get install -y build-essential
-RUN apt-get install -y cppcheck
-
-# Install python dependensices
-RUN python3 -m pip install packaging
-
-# Install aqt
-RUN python3 -m pip install aqtinstall
-
-# Install QT dependencies
-RUN apt-get install -y libxcb-icccm4
-RUN apt-get install -y libxcb-image0
-RUN apt-get install -y libxcb-keysyms1
-RUN apt-get install -y libxcb-render-util0
-RUN apt-get install -y libxcb-xinerama0
-RUN apt-get install -y libxcb-xkb1
-RUN apt-get install -y libxkbcommon-x11-0
-RUN apt-get install -y libxcb-randr0
-RUN apt-get install -y libegl1
-
-# Install QT
-RUN aqt install-qt linux desktop 5.15.2 gcc_64 -m all -O /opt/qt/
-
-# Install Appimage dependencies
-RUN apt-get install -y libfuse2
-
-# Install Appimage tools
-ADD https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage /usr/local/bin/linuxdeploy
-RUN chmod +x /usr/local/bin/linuxdeploy
-ADD https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage /usr/local/bin/linuxdeploy-plugin-qt
-RUN chmod +x /usr/local/bin/linuxdeploy-plugin-qt
-ADD https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
-RUN chmod +x /usr/local/bin/appimagetool
-
-# Install MXE requirements
-RUN apt-get install -y autoconf
-RUN apt-get install -y automake
-RUN apt-get install -y autopoint
-RUN apt-get install -y bison
-RUN apt-get install -y bzip2
-RUN apt-get install -y flex
-RUN apt-get install -y g++
-RUN apt-get install -y g++-multilib
-RUN apt-get install -y gettext
-RUN apt-get install -y gperf
-RUN apt-get install -y intltool
-RUN apt-get install -y libc6-dev-i386
-RUN apt-get install -y libgdk-pixbuf2.0-dev
-RUN apt-get install -y libltdl-dev
-RUN apt-get install -y libgl-dev
-RUN apt-get install -y libssl-dev
-RUN apt-get install -y libtool-bin
-RUN apt-get install -y libxml-parser-perl
-RUN apt-get install -y lzip
-RUN apt-get install -y make
-RUN apt-get install -y openssl
-RUN apt-get install -y p7zip-full
-RUN apt-get install -y patch
-RUN apt-get install -y perl
-RUN apt-get install -y python3-mako
-RUN apt-get install -y python3-pkg-resources
-RUN apt-get install -y ruby
-RUN apt-get install -y sed
-RUN apt-get install -y xz-utils
-
-# Download MXE
-RUN git clone https://github.com/mxe/mxe
-
-RUN apt-get install -y wget
-RUN apt-get install -y python-is-python3
-
-# Compile MXE
-RUN \
-    --mount=type=cache,target=/mxe/usr/bin\
-     cd mxe && make MXE_TARGETS=x86_64-w64-mingw32.static qt5
diff --git a/DockerfileLinux b/DockerfileLinux
new file mode 100644
index 0000000..0649b87
--- /dev/null
+++ b/DockerfileLinux
@@ -0,0 +1,52 @@
+FROM ubuntu:22.04
+
+# Update package manager cache
+RUN apt-get update
+
+# Install essential packages
+RUN apt-get install -y git
+RUN apt-get install -y wget
+RUN apt-get install -y python3
+RUN apt-get install -y python3-pip
+RUN apt-get install -y python-is-python3
+
+# Meson dependencies
+RUN python3 -m pip install packaging
+
+# Appimage dependencies
+RUN apt-get install -y libfuse2
+
+# Build dependencies
+RUN apt-get install -y cmake
+RUN apt-get install -y ccache
+
+# Qt dependencies
+RUN apt-get install -y libxcb-icccm4
+RUN apt-get install -y libxcb-image0
+RUN apt-get install -y libxcb-keysyms1
+RUN apt-get install -y libxcb-render-util0
+RUN apt-get install -y libxcb-xinerama0
+RUN apt-get install -y libxcb-xkb1
+RUN apt-get install -y libxkbcommon-x11-0
+RUN apt-get install -y libxcb-randr0
+RUN apt-get install -y libegl1
+RUN apt-get install -y mesa-common-dev
+RUN apt-get install -y libglu1-mesa-dev
+RUN apt-get install -y libglib2.0-0
+
+# Install aqt
+RUN python -m pip install aqtinstall
+
+# Install Qt
+RUN aqt install-qt linux desktop 5.15.2 gcc_64 -m all -O /opt/qt/
+
+# Install linuxdeploy with qt plugin and appimagetool
+ADD https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage /usr/local/bin/linuxdeploy
+RUN chmod +x /usr/local/bin/linuxdeploy
+ADD https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage /usr/local/bin/linuxdeploy-plugin-qt
+RUN chmod +x /usr/local/bin/linuxdeploy-plugin-qt
+ADD https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
+RUN chmod +x /usr/local/bin/appimagetool
+
+# Add Qt5 to PATH
+ENV PATH="/opt/qt/5.15.2/gcc_64:$PATH"
diff --git a/DockerfileWindows b/DockerfileWindows
new file mode 100644
index 0000000..e4d6e50
--- /dev/null
+++ b/DockerfileWindows
@@ -0,0 +1,62 @@
+FROM ubuntu:22.04
+
+# Update package manager cache
+RUN apt-get update
+
+# Install essential packages
+RUN apt-get install -y git
+RUN apt-get install -y wget
+RUN apt-get install -y python3
+RUN apt-get install -y python3-pip
+RUN apt-get install -y python-is-python3
+
+# Meson dependencies
+RUN python3 -m pip install packaging
+
+# MXE dependencies
+RUN apt-get install -y autoconf
+RUN apt-get install -y automake
+RUN apt-get install -y autopoint
+RUN apt-get install -y bison
+RUN apt-get install -y bzip2
+RUN apt-get install -y flex
+RUN apt-get install -y g++
+RUN apt-get install -y g++-multilib
+RUN apt-get install -y gettext
+RUN apt-get install -y gperf
+RUN apt-get install -y intltool
+RUN apt-get install -y libc6-dev-i386
+RUN apt-get install -y libgdk-pixbuf2.0-dev
+RUN apt-get install -y libltdl-dev
+RUN apt-get install -y libgl-dev
+RUN apt-get install -y libssl-dev
+RUN apt-get install -y libtool-bin
+RUN apt-get install -y libxml-parser-perl
+RUN apt-get install -y lzip
+RUN apt-get install -y make
+RUN apt-get install -y openssl
+RUN apt-get install -y p7zip-full
+RUN apt-get install -y patch
+RUN apt-get install -y perl
+RUN apt-get install -y python3-mako
+RUN apt-get install -y python3-pkg-resources
+RUN apt-get install -y ruby
+RUN apt-get install -y sed
+RUN apt-get install -y xz-utils
+
+# Download MXE
+RUN git clone https://github.com/mxe/mxe
+
+# Compile cross compiler and basic packages
+RUN cd mxe && make download-cc MXE_PLUGIN_DIRS=plugins/gcc14
+RUN cd mxe && make cc MXE_PLUGIN_DIRS=plugins/gcc14 MXE_TARGETS=x86_64-w64-mingw32.static --jobs=4 JOBS=16
+
+# Compile Qt5
+RUN cd mxe && make download-qt5 MXE_PLUGIN_DIRS=plugins/gcc14
+RUN cd mxe && make qt5 MXE_PLUGIN_DIRS=plugins/gcc14 MXE_TARGETS=x86_64-w64-mingw32.static --jobs=4 JOBS=16
+
+# Install ccache
+RUN apt-get install -y ccache
+
+# Add MXE to PATH
+ENV PATH="/mxe/usr/bin:$PATH"
-- 
GitLab