Skip to content

Commit 943bb8d

Browse files
committed
add Dockerfile
1 parent 729258b commit 943bb8d

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

Dockerfile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
FROM ubuntu:latest as build
2+
3+
ENV TZ=Europe/Rome
4+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
5+
apt-get update && \
6+
# TODO add --no-install-recommends
7+
apt-get install -y \
8+
build-essential \
9+
# Intall clang compiler used by macos
10+
clang \
11+
cmake \
12+
curl \
13+
dh-autoreconf \
14+
git \
15+
gperf \
16+
# various libs required to compile osxcross
17+
libxml2-dev \
18+
libssl-dev \
19+
libz-dev \
20+
# liblzma5 \
21+
# Install Windows cross-tools
22+
mingw-w64 \
23+
p7zip-full \
24+
pkg-config \
25+
tar \
26+
# xz-utils \
27+
&& rm -rf /var/lib/apt/lists/*
28+
# Install toolchains in /opt
29+
RUN curl downloads.arduino.cc/tools/internal/toolchains.tar.gz | tar -xz "opt"
30+
# install proper arm toolchains (already present in the toolchains.tar.gz archive)
31+
# curl -L 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz' | tar -xJC /opt && \
32+
# curl -L 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz' | tar -xJC /opt
33+
34+
RUN cd /opt/osxcross \
35+
git pull \
36+
# use a specific version of osxcross (it does not have tags)
37+
git checkout da2c3d4ff604458a931b08b3af800c5a454136de \
38+
UNATTENDED=1 SDK_VERSION=10.15 ./build.sh
39+
# Set toolchains paths
40+
# arm-linux-gnueabihf-gcc -> linux_arm
41+
# aarch64-linux-gnu-gcc -> linux_arm64
42+
# x86_64-ubuntu16.04-linux-gnu-gcc -> linux_amd64
43+
# i686-ubuntu16.04-linux-gnu-gcc -> linux_386
44+
# o64-clang -> darwin_amd64
45+
ENV PATH=/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/:/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/:/opt/x86_64-ubuntu16.04-linux-gnu-gcc/bin/:/opt/i686-ubuntu16.04-linux-gnu/bin/:/opt/osxcross/target/bin/:$PATH
46+
47+
WORKDIR /workdir
48+
49+
# Handle libusb and libudev compilation and merging
50+
COPY deps/ /opt/lib/
51+
# compiler name is arm-linux-gnueabihf-gcc '-gcc' is added by ./configure
52+
RUN CROSS_COMPILE=x86_64-ubuntu16.04-linux-gnu /opt/lib/build_libs.sh && \
53+
CROSS_COMPILE=arm-linux-gnueabihf /opt/lib/build_libs.sh && \
54+
CROSS_COMPILE=aarch64-linux-gnu /opt/lib/build_libs.sh && \
55+
CROSS_COMPILE=i686-ubuntu16.04-linux-gnu /opt/lib/build_libs.sh && \
56+
CROSS_COMPILE=i686-w64-mingw32 /opt/lib/build_libs.sh && \
57+
# CROSS_COMPILER is used to override the compiler
58+
CROSS_COMPILER=o64-clang CROSS_COMPILE=x86_64-apple-darwin13 /opt/lib/build_libs.sh
59+
60+
FROM ubuntu:latest
61+
# Copy all the installed toolchains and compiled libs
62+
COPY --from=build /opt /opt
63+
ENV TZ=Europe/Rome
64+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
65+
apt-get update && \
66+
apt-get install -y \
67+
build-essential \
68+
# Intall clang compiler used by macos
69+
clang \
70+
cmake \
71+
dh-autoreconf \
72+
git \
73+
gperf \
74+
# Install Windows cross-tools
75+
mingw-w64 \
76+
pkg-config \
77+
tar \
78+
&& rm -rf /var/lib/apt/lists/*
79+
# Set toolchains paths
80+
# arm-linux-gnueabihf-gcc -> linux_arm
81+
# aarch64-linux-gnu-gcc -> linux_arm64
82+
# x86_64-ubuntu16.04-linux-gnu-gcc -> linux_amd64
83+
# i686-ubuntu16.04-linux-gnu-gcc -> linux_386
84+
# o64-clang -> darwin_amd64
85+
ENV PATH=/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/:/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/:/opt/x86_64-ubuntu16.04-linux-gnu-gcc/bin/:/opt/i686-ubuntu16.04-linux-gnu/bin/:/opt/osxcross/target/bin/:$PATH
86+
87+
WORKDIR /workdir
88+
89+
ENTRYPOINT ["/bin/bash"]

0 commit comments

Comments
 (0)