Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Commit a347824

Browse files
schultetwin1Matt Schulte
authored and
Matt Schulte
committed
Adds arm64 cross compile support to Dockerfile
1 parent c863600 commit a347824

File tree

4 files changed

+119
-34
lines changed

4 files changed

+119
-34
lines changed

scripts/Dockerfile

Lines changed: 0 additions & 34 deletions
This file was deleted.

scripts/docker/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ARG UBUNTU_VERSION=18.04
2+
# Use the official ubuntu:18.04 image as the parent image
3+
FROM ubuntu:${UBUNTU_VERSION}
4+
5+
# Set the working directory to /app
6+
WORKDIR /app
7+
8+
ARG ARCH=amd64
9+
10+
ADD setup-ubuntu.sh /app
11+
ADD sources.list /app
12+
13+
# Tell Ubuntu non-interactive install
14+
ARG DEBIAN_FRONTEND=noninteractive
15+
16+
17+
RUN ./setup-ubuntu.sh ${ARCH}
18+
19+
RUN apt-get install -y ca-certificates
20+
RUN update-ca-certificates

scripts/docker/setup-ubuntu.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
3+
# Usage:
4+
# ./setup-ubuntu.sh [arm64 | amd64]
5+
6+
# Warning! This will override your sources.list file!!
7+
8+
arch=amd64
9+
10+
# Copy off old sources.list file
11+
cp /etc/apt/sources.list /etc/apt/sources.list.old
12+
echo "Backed up /etc/apt/sources.list to /etc/apt/sources.list.old"
13+
14+
# Copy over the new file
15+
cp sources.list /etc/apt/sources.list
16+
echo "Overwrote /etc/apt/sources.list with sources.list"
17+
18+
apt-get update
19+
20+
apt-get install wget -y
21+
22+
# Add Public microsoft repo keys to the image
23+
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
24+
dpkg -i packages-microsoft-prod.deb
25+
26+
if [ "$1" = "arm64" ]; then
27+
arch="arm64"
28+
fi
29+
30+
echo "Setting up for building $arch binaries"
31+
32+
dpkg --add-architecture amd64
33+
dpkg --add-architecture arm64
34+
35+
apt-get update
36+
37+
packages=(\
38+
gcc-aarch64-linux-gnu \
39+
g++-aarch64-linux-gnu \
40+
qemu \
41+
binfmt-support \
42+
qemu-user-static \
43+
pkg-config \
44+
ninja-build \
45+
doxygen \
46+
clang \
47+
python3 \
48+
gcc \
49+
g++ \
50+
git \
51+
git-lfs \
52+
nasm \
53+
cmake \
54+
powershell \
55+
libgl1-mesa-dev:$arch \
56+
libsoundio-dev:$arch \
57+
libjpeg-dev:$arch \
58+
libvulkan-dev:$arch \
59+
libx11-dev:$arch \
60+
libxcursor-dev:$arch \
61+
libxinerama-dev:$arch \
62+
libxrandr-dev:$arch \
63+
libusb-1.0-0-dev:$arch \
64+
libssl-dev:$arch \
65+
libudev-dev:$arch \
66+
mesa-common-dev:$arch \
67+
uuid-dev:$arch )
68+
69+
if [ "$arch" = "amd64" ]; then
70+
packages+=(libopencv-dev:$arch)
71+
fi
72+
73+
apt-get install -y --no-install-recommends ${packages[@]}

scripts/docker/sources.list

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic main restricted
3+
deb [arch=arm64] http://ports.ubuntu.com/ bionic main restricted
4+
5+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
6+
deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates main restricted
7+
8+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic universe
9+
deb [arch=arm64] http://ports.ubuntu.com/ bionic universe
10+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates universe
11+
deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates universe
12+
13+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic multiverse
14+
deb [arch=arm64] http://ports.ubuntu.com/ bionic multiverse
15+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
16+
deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates multiverse
17+
18+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
19+
deb [arch=arm64] http://ports.ubuntu.com/ bionic-backports main restricted universe multiverse
20+
21+
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ bionic-security main restricted
22+
deb [arch=arm64] http://ports.ubuntu.com/ bionic-security main restricted
23+
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ bionic-security universe
24+
deb [arch=arm64] http://ports.ubuntu.com/ bionic-security universe
25+
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ bionic-security multiverse
26+
deb [arch=arm64] http://ports.ubuntu.com/ bionic-security multiverse

0 commit comments

Comments
 (0)