Skip to content

Commit

Permalink
Add separate Docker image for i386
Browse files Browse the repository at this point in the history
  • Loading branch information
botder committed May 1, 2023
1 parent 5df6d1f commit 9944aeb
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- '.github/workflows/dockerimage.yaml'
- 'utils/compat/**'
- 'Dockerfile'
- 'Dockerfile.i386'
- 'Dockerfile.armhf'
- 'Dockerfile.arm64'

Expand All @@ -19,6 +20,8 @@ jobs:
include:
- tag: latest
dockerfile: Dockerfile
- tag: i386
dockerfile: Dockerfile.i386
- tag: armhf
dockerfile: Dockerfile.armhf
- tag: arm64
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions Dockerfile.i386
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion utils/compat/glibc_version_x86.redef
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions utils/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 9944aeb

Please sign in to comment.