From 14c5400424a0ed49d774ddaf69442c805adf5eb8 Mon Sep 17 00:00:00 2001 From: Marcos Gamez Date: Sun, 16 Mar 2025 13:42:24 +0100 Subject: [PATCH 1/3] add Dockerfile and docker-compose to build the code --- Dockerfile | 92 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 7 ++++ 2 files changed, 99 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..b4aebab6bc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,92 @@ +FROM ubuntu:24.10 + +WORKDIR /build + +# Install utils +RUN apt update +RUN apt install wget gpg unzip git -y + +# Install wine32 +RUN dpkg --add-architecture i386 +RUN mkdir -pm755 /etc/apt/keyrings +RUN wget -O - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key - +RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/oracular/winehq-oracular.sources +RUN apt update +RUN apt install --install-recommends winehq-stable -y + +WORKDIR /build/tools/ + +# Install cmake windows +RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-windows-x86_64.zip +RUN unzip cmake-3.31.6-windows-x86_64.zip -d /build/tools/ +RUN mv /build/tools/cmake-3.31.6-windows-x86_64 /build/tools/cmake + +# Install git windows +RUN wget https://github.com/git-for-windows/git/releases/download/v2.49.0-rc1.windows.1/MinGit-2.49.0-rc1-64-bit.zip +RUN unzip MinGit-2.49.0-rc1-64-bit.zip -d /build/tools/ +RUN mv /build/tools/cmd /build/tools/git + +# Install Visual Studio 6 Portable +RUN wget https://github.com/itsmattkc/MSVC600/archive/refs/heads/master.zip +RUN unzip master.zip -d /build/tools +RUN mv /build/tools/MSVC600-master/ /build/tools/vs6 + +WORKDIR /build + +# Setup wine prefix +ENV WINEDEBUG=-all +ENV WINEARCH=win64 +ENV WINEPREFIX=/build/prefix64 +RUN wineboot + +# Create empty TEMP folder for linking +RUN mkdir /build/tmp +ENV TMP="Z:\\build\\tmp" +ENV TEMP="Z:\\build\\tmp" +ENV TEMPDIR="Z:\\build\\tmp" + +# Setup Visual Studio 6 Environment variables +ENV VS="Z:\\build\\tools\\vs6" +ENV MSVCDir="$VS\\vc98" +ENV WINEPATH="C:\\windows\\system32;\ +$VS\\vc98\\bin;\ +$VS\\vc98\\lib;\ +$VS\\vc98\\include;\ +$VS\\common\\Tools;\ +$VS\\common\\MSDev98\\bin" +ENV LIB="$VS\\vc98\\Lib;$VS\\vc98\\MFC\\Lib;Z:\\build\\cnc\\build\\vc6" +ENV INCLUDE="$VS\\vc98\\ATL\\INCLUDE;\ +$VS\\vc98\\INCLUDE;\ +$VS\\vc98\\MFC\\INCLUDE;\ +$VS\\vc98\\Include" +ENV CC="$VS\\vc98\\bin\\CL.exe" +ENV CXX="$VS\\vc98\\bin\\CL.exe" + +WORKDIR /build/cnc + +# Copy Source code +ENV GIT_VERSION_STRING="2.49.0" +# Enable if you dont build with docker compose +# COPY . . +WORKDIR /build/cnc +VOLUME /build/cnc + +# Compile +CMD wine /build/tools/cmake/bin/cmake.exe \ + --preset vc6 \ + -DCMAKE_SYSTEM="Windows" \ + -DCMAKE_SYSTEM_NAME="Windows" \ + -DCMAKE_SIZEOF_VOID_P=4 \ + -DCMAKE_MAKE_PROGRAM="Z:/build/tools/vs6/vc98/bin/nmake.exe" \ + -DCMAKE_C_COMPILER="Z:/build/tools/vs6/vc98/bin/cl.exe" \ + -DCMAKE_CXX_COMPILER="Z:/build/tools/vs6/vc98/bin/cl.exe" \ + -DGIT_EXECUTABLE="Z:/build/tools/git/git.exe" \ + -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ + -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \ + -DCMAKE_C_COMPILER_WORKS=1 \ + -DCMAKE_CXX_COMPILER_WORKS=1 \ + -B /build/cnc/build/docker \ +&& cd /build/cnc/build/docker \ +&& wine cmd /c "set TMP=Z:\build\tmp& set TEMP=Z:\build\tmp& Z:\build\tools\vs6\VC98\Bin\NMAKE.exe" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..0150fce60c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + builder: + build: + context: . + dockerfile: Dockerfile + volumes: + - "./:/build/cnc" From 2da991c401e1b532a0fb84bb664843d7aeae16b0 Mon Sep 17 00:00:00 2001 From: Marcos Gamez Date: Sun, 16 Mar 2025 19:43:31 +0100 Subject: [PATCH 2/3] optimization reduce size to 2.8 GB --- Dockerfile | 83 +++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index b4aebab6bc..92e2ecfc3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,42 @@ -FROM ubuntu:24.10 +FROM debian:12.9-slim WORKDIR /build # Install utils -RUN apt update -RUN apt install wget gpg unzip git -y +RUN apt update \ + && apt install wget gpg unzip git -y \ + && dpkg --add-architecture i386 -# Install wine32 -RUN dpkg --add-architecture i386 -RUN mkdir -pm755 /etc/apt/keyrings -RUN wget -O - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key - -RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/oracular/winehq-oracular.sources -RUN apt update -RUN apt install --install-recommends winehq-stable -y +# Install wine +RUN mkdir -pm755 /etc/apt/keyrings \ + && (wget -O - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key -) \ + && wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bookworm/winehq-bookworm.sources \ + && apt update \ + && apt install --no-install-recommends winehq-stable -y + +# Clean up APT +RUN apt clean \ + && rm -rf /var/lib/apt/lists/* \ WORKDIR /build/tools/ # Install cmake windows -RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-windows-x86_64.zip -RUN unzip cmake-3.31.6-windows-x86_64.zip -d /build/tools/ -RUN mv /build/tools/cmake-3.31.6-windows-x86_64 /build/tools/cmake +RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-windows-x86_64.zip \ + && unzip cmake-3.31.6-windows-x86_64.zip -d /build/tools/ \ + && mv /build/tools/cmake-3.31.6-windows-x86_64 /build/tools/cmake # Install git windows -RUN wget https://github.com/git-for-windows/git/releases/download/v2.49.0-rc1.windows.1/MinGit-2.49.0-rc1-64-bit.zip -RUN unzip MinGit-2.49.0-rc1-64-bit.zip -d /build/tools/ -RUN mv /build/tools/cmd /build/tools/git +RUN wget https://github.com/git-for-windows/git/releases/download/v2.49.0-rc1.windows.1/MinGit-2.49.0-rc1-64-bit.zip \ + && unzip MinGit-2.49.0-rc1-64-bit.zip -d /build/tools/ \ + && mv /build/tools/cmd /build/tools/git # Install Visual Studio 6 Portable -RUN wget https://github.com/itsmattkc/MSVC600/archive/refs/heads/master.zip -RUN unzip master.zip -d /build/tools -RUN mv /build/tools/MSVC600-master/ /build/tools/vs6 +RUN wget https://github.com/itsmattkc/MSVC600/archive/refs/heads/master.zip \ + && unzip master.zip -d /build/tools \ + && mv /build/tools/MSVC600-master/ /build/tools/vs6 + +# Clean up downloads +RUN find /build/tools/ -name "*.zip" -exec rm -f {} + WORKDIR /build @@ -37,7 +44,6 @@ WORKDIR /build ENV WINEDEBUG=-all ENV WINEARCH=win64 ENV WINEPREFIX=/build/prefix64 -RUN wineboot # Create empty TEMP folder for linking RUN mkdir /build/tmp @@ -72,21 +78,22 @@ WORKDIR /build/cnc VOLUME /build/cnc # Compile -CMD wine /build/tools/cmake/bin/cmake.exe \ - --preset vc6 \ - -DCMAKE_SYSTEM="Windows" \ - -DCMAKE_SYSTEM_NAME="Windows" \ - -DCMAKE_SIZEOF_VOID_P=4 \ - -DCMAKE_MAKE_PROGRAM="Z:/build/tools/vs6/vc98/bin/nmake.exe" \ - -DCMAKE_C_COMPILER="Z:/build/tools/vs6/vc98/bin/cl.exe" \ - -DCMAKE_CXX_COMPILER="Z:/build/tools/vs6/vc98/bin/cl.exe" \ - -DGIT_EXECUTABLE="Z:/build/tools/git/git.exe" \ - -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ - -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \ - -DCMAKE_C_COMPILER_WORKS=1 \ - -DCMAKE_CXX_COMPILER_WORKS=1 \ - -B /build/cnc/build/docker \ -&& cd /build/cnc/build/docker \ -&& wine cmd /c "set TMP=Z:\build\tmp& set TEMP=Z:\build\tmp& Z:\build\tools\vs6\VC98\Bin\NMAKE.exe" +CMD wineboot \ + && wine /build/tools/cmake/bin/cmake.exe \ + --preset vc6 \ + -DCMAKE_SYSTEM="Windows" \ + -DCMAKE_SYSTEM_NAME="Windows" \ + -DCMAKE_SIZEOF_VOID_P=4 \ + -DCMAKE_MAKE_PROGRAM="Z:/build/tools/vs6/vc98/bin/nmake.exe" \ + -DCMAKE_C_COMPILER="Z:/build/tools/vs6/vc98/bin/cl.exe" \ + -DCMAKE_CXX_COMPILER="Z:/build/tools/vs6/vc98/bin/cl.exe" \ + -DGIT_EXECUTABLE="Z:/build/tools/git/git.exe" \ + -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ + -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \ + -DCMAKE_C_COMPILER_WORKS=1 \ + -DCMAKE_CXX_COMPILER_WORKS=1 \ + -B /build/cnc/build/docker \ + && cd /build/cnc/build/docker \ + && wine cmd /c "set TMP=Z:\build\tmp& set TEMP=Z:\build\tmp& Z:\build\tools\vs6\VC98\Bin\NMAKE.exe" From 2b9a53eed2edf863f55dcb79928072c9ccad0f8a Mon Sep 17 00:00:00 2001 From: Marcos Gamez Date: Sat, 29 Mar 2025 19:32:22 +0100 Subject: [PATCH 3/3] add build ARG and a ENV for Dockerfile Signed-off-by: Marcos Gamez --- Dockerfile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 92e2ecfc3b..9ac546fa3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,8 @@ -FROM debian:12.9-slim +FROM debian:12.10-slim + +# Build arguments +ARG CMAKE_VERSION="3.31.6" +ARG GIT_VERSION="2.49.0" WORKDIR /build @@ -21,13 +25,13 @@ RUN apt clean \ WORKDIR /build/tools/ # Install cmake windows -RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-windows-x86_64.zip \ - && unzip cmake-3.31.6-windows-x86_64.zip -d /build/tools/ \ - && mv /build/tools/cmake-3.31.6-windows-x86_64 /build/tools/cmake +RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-windows-x86_64.zip \ + && unzip cmake-${CMAKE_VERSION}-windows-x86_64.zip -d /build/tools/ \ + && mv /build/tools/cmake-${CMAKE_VERSION}-windows-x86_64 /build/tools/cmake # Install git windows -RUN wget https://github.com/git-for-windows/git/releases/download/v2.49.0-rc1.windows.1/MinGit-2.49.0-rc1-64-bit.zip \ - && unzip MinGit-2.49.0-rc1-64-bit.zip -d /build/tools/ \ +RUN wget https://github.com/git-for-windows/git/releases/download/v${GIT_VERSION}.windows.1/MinGit-${GIT_VERSION}-64-bit.zip \ + && unzip MinGit-${GIT_VERSION}-64-bit.zip -d /build/tools/ \ && mv /build/tools/cmd /build/tools/git # Install Visual Studio 6 Portable @@ -77,10 +81,12 @@ ENV GIT_VERSION_STRING="2.49.0" WORKDIR /build/cnc VOLUME /build/cnc +ENV PRESET=vc6 + # Compile CMD wineboot \ && wine /build/tools/cmake/bin/cmake.exe \ - --preset vc6 \ + --preset ${PRESET} \ -DCMAKE_SYSTEM="Windows" \ -DCMAKE_SYSTEM_NAME="Windows" \ -DCMAKE_SIZEOF_VOID_P=4 \