From 9944aeb498fa89c7feaf68e628013d18c123002f Mon Sep 17 00:00:00 2001 From: Marek Kulik Date: Mon, 1 May 2023 18:58:19 +0200 Subject: [PATCH] Add separate Docker image for i386 --- .github/workflows/dockerimage.yaml | 3 +++ Dockerfile | 6 ++---- Dockerfile.i386 | 28 ++++++++++++++++++++++++++++ utils/compat/glibc_version_x86.redef | 1 - utils/docker-entrypoint.sh | 6 ++---- 5 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 Dockerfile.i386 diff --git a/.github/workflows/dockerimage.yaml b/.github/workflows/dockerimage.yaml index f79baf0363..53077f8dfe 100644 --- a/.github/workflows/dockerimage.yaml +++ b/.github/workflows/dockerimage.yaml @@ -9,6 +9,7 @@ on: - '.github/workflows/dockerimage.yaml' - 'utils/compat/**' - 'Dockerfile' + - 'Dockerfile.i386' - 'Dockerfile.armhf' - 'Dockerfile.arm64' @@ -19,6 +20,8 @@ jobs: include: - tag: latest dockerfile: Dockerfile + - tag: i386 + dockerfile: Dockerfile.i386 - tag: armhf dockerfile: Dockerfile.armhf - tag: arm64 diff --git a/Dockerfile b/Dockerfile index 2b7b1c96c0..36a60ee2f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,12 +9,10 @@ ENV AS_BUILDAGENT=0 \ BUILD_CONFIG=release # Install build-time dependencies -RUN dpkg --add-architecture i386 && apt-get update && \ +RUN apt-get update && \ apt-get install -y software-properties-common wget ca-certificates git build-essential \ gcc-multilib g++-multilib gcc-10-multilib g++-10-multilib curl subversion ncftp \ - libncurses-dev libncursesw5 \ - libncurses-dev:i386 libncursesw5:i386 \ - libmysqlclient-dev + libncurses-dev libncursesw5 libmysqlclient-dev # Set build directory VOLUME /build diff --git a/Dockerfile.i386 b/Dockerfile.i386 new file mode 100644 index 0000000000..41a81ba8ad --- /dev/null +++ b/Dockerfile.i386 @@ -0,0 +1,28 @@ +FROM jetbrains/teamcity-minimal-agent:latest + +# This is important for using apt-get +USER root + +# Default build configuration +ENV AS_BUILDAGENT=0 \ + BUILD_ARCHITECTURE=x86 \ + BUILD_CONFIG=release + +# Install build-time dependencies +RUN dpkg --add-architecture i386 && apt-get update && \ + apt-get install -y software-properties-common wget ca-certificates git build-essential \ + gcc-multilib g++-multilib gcc-10-multilib g++-10-multilib curl subversion ncftp \ + libncurses-dev:i386 libncursesw5:i386 libmysqlclient-dev:i386 + +# Set build directory +VOLUME /build +WORKDIR /build + +# Copy entrypoint script +COPY utils/docker-entrypoint.sh /docker-entrypoint.sh + +# Add GLIB compat +COPY utils/compat /compat + +# Set entrypoint +ENTRYPOINT bash /docker-entrypoint.sh diff --git a/utils/compat/glibc_version_x86.redef b/utils/compat/glibc_version_x86.redef index 8ba2d95ade..12c4fedfa7 100644 --- a/utils/compat/glibc_version_x86.redef +++ b/utils/compat/glibc_version_x86.redef @@ -11,5 +11,4 @@ log log@GLIBC_2.0 log2 log2@GLIBC_2.1 pow pow@GLIBC_2.0 exp exp@GLIBC_2.0 -fcntl64 fcntl@GLIBC_2.0 fcntl fcntl@GLIBC_2.0 diff --git a/utils/docker-entrypoint.sh b/utils/docker-entrypoint.sh index a1a30a64c6..698bac72fa 100644 --- a/utils/docker-entrypoint.sh +++ b/utils/docker-entrypoint.sh @@ -1,21 +1,19 @@ #!/bin/bash # 64-bits -if [ ! -d /compat/x64 ]; then +if [ ! -d /compat/x64 ] && [ -f /usr/lib/x86_64-linux-gnu/libmysqlclient.a ]; then mkdir -p /compat/x64 objcopy --redefine-syms=/compat/glibc_version_x64.redef "$(gcc --print-file-name=libstdc++.a)" /compat/x64/libstdc++.a objcopy --redefine-syms=/compat/glibc_version_x64.redef /usr/lib/x86_64-linux-gnu/libmysqlclient.a /compat/x64/libmysqlclient.a fi # 32-bits -if [ ! -d /compat/x86 ] && [[ $BUILD_BITS = "32" ]]; then - apt-get update && apt-get install -y libmysqlclient-dev:i386 +if [ ! -d /compat/x86 ] && [ -f /usr/lib/i386-linux-gnu/libmysqlclient.a ]; then mkdir -p /compat/x86 objcopy --redefine-syms=/compat/glibc_version_x86.redef "$(gcc -m32 --print-file-name=libstdc++.a)" /compat/x86/libstdc++.a objcopy --redefine-syms=/compat/glibc_version_x86.redef /usr/lib/i386-linux-gnu/libmysqlclient.a /compat/x86/libmysqlclient.a fi - # If configurede as a build agent, start Teamcity agent if [[ $AS_BUILDAGENT = "1" ]]; then # https://github.com/JetBrains/teamcity-docker-minimal-agent/blob/master/Dockerfile#L17