Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,28 @@
&& target_build_arch=x86 \
|| target_build_arch="$TARGET_BUILD_ARCH"

case "$target_build_arch" in
armv8*)
container_platform="linux/arm64"
;;

arm*) # Unknown "arm" are marked as 32-bit platforms
container_platform="linux/arm"
;;

x86|x86_64) # Ubuntu images don't have a i386 tag, must run the container with a amd64 tag, let's just not support i386 builders
container_platform="linux/amd64"
;;

*)
echo "Unsupported container platform: $target_build_arch"
exit 1
;;
esac

docker build \
--platform "$container_platform" \
--build-arg "TARGET_CONTAINER_BUILD_ARCH=$target_build_arch" \
-t open.mp/build:ubuntu-${ubuntu_version} \
build_ubuntu-${ubuntu_version}/ \
|| exit 1
Expand All @@ -41,6 +62,7 @@ done
docker run \
--rm \
-t \
--platform "$container_platform" \
-w /code \
-v $PWD/..:/code \
-v $PWD/build:/code/build \
Expand Down
42 changes: 33 additions & 9 deletions docker/build_ubuntu-22.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
FROM ubuntu:22.04
RUN \
dpkg --add-architecture i386 && \
apt-get update && \
ARG TARGET_CONTAINER_BUILD_ARCH

# Fix for some rootless builders
ENV DEBIAN_FRONTEND=noninteractive

# Base layer
RUN apt-get update && \
apt-get install -y \
cmake \
ninja-build \
clang-11 \
python3-pip \
gcc-9-multilib \
g++-9-multilib \
libstdc++-11-dev:i386 \
&& \
python3-pip && \
rm -rf /var/lib/apt/lists/* && \
useradd -m user && \
su user -c 'pip3 install --user conan'

# Arch-specific layer
RUN case "$TARGET_CONTAINER_BUILD_ARCH" in \
x86_64|x86) \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y \
gcc-9-multilib \
g++-9-multilib \
libstdc++-11-dev:i386 \
;; \
arm*) \
apt-get update && \
apt-get install -y \
libstdc++6 \
libc6 \
;; \
*) \
echo "Unsupported TARGET_CONTAINER_BUILD_ARCH: $TARGET_CONTAINER_BUILD_ARCH" >&2 \
exit 1 \
;; \
esac && \
rm -rf /var/lib/apt/lists/*

USER user

ENV CC=/usr/bin/clang-11 \
CXX=/usr/bin/clang++-11 \
PATH=~/.local/bin:${PATH}
PATH=/home/user/.local/bin:${PATH}

COPY docker-entrypoint.sh /
CMD /docker-entrypoint.sh
29 changes: 22 additions & 7 deletions docker/run_ubuntu-22.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN \
dpkg --add-architecture i386 && \
apt-get update && \
ARG TARGET_CONTAINER_PLATFORM

# Base layer
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
libstdc++6:i386 \
ca-certificates \
tzdata \
openssl \
libssl3 \
libssl-dev \
&& \
python3 \
libatomic1 \
libstdc++6 \
libssl3 && \
rm -rf /var/lib/apt/lists/* && \
useradd -m user

# Arch-specific layer
RUN case "$TARGET_CONTAINER_PLATFORM" in \
linux/amd64) \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --no-install-recommends \
libstdc++6:i386 \
libssl3:i386 \
;; \
esac && \
rm -rf /var/lib/apt/lists/*

USER user
WORKDIR /home/user

Expand Down