-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
171 lines (139 loc) · 6.06 KB
/
Dockerfile
File metadata and controls
171 lines (139 loc) · 6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#
# Builds the toolshed/ubuntu-22.04 toolchain container.
#
FROM ubuntu:24.04 AS base
LABEL org.opencontainers.image.source=https://github.com/OpenCyphal/docker_toolchains
LABEL org.opencontainers.image.description="Provides a consistent build and test environment for development, continuous-integration, and test automation of OpenCyphal C and C++ based projects."
LABEL org.opencontainers.image.licenses=MIT
ARG TARGETARCH
VOLUME /repo
WORKDIR /repo
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
# +---------------------------------------------------------------------------+
# | UBUNTU PROVISIONING
# +---------------------------------------------------------------------------+
FROM base AS provisioning
WORKDIR /tmp
ADD kitware-archive-latest.asc .
ADD pre-provision.sh ./pre-provision.sh
ADD provision-repositories.sh ./provision-repositories.sh
ADD provision-repositories-${TARGETARCH}.sh ./provision-repositories-${TARGETARCH}.sh
ADD provision.sh ./provision.sh
ADD provision-${TARGETARCH}.sh ./provision-${TARGETARCH}.sh
ADD post-provision.sh ./post-provision.sh
RUN apt update
RUN ./pre-provision.sh
RUN ./provision-repositories.sh
RUN ./provision-repositories-${TARGETARCH}.sh
RUN apt update
RUN ./provision.sh
RUN ./provision-${TARGETARCH}.sh
RUN ./post-provision.sh
# INSTALL THE PATH FOR INTERACTIVE SESSIONS
RUN echo "export PATH=$PATH" >> ~/.bashrc
# +---------------------------------------------------------------------------+
# | LLVM
# +---------------------------------------------------------------------------+
FROM provisioning AS llvm
WORKDIR /tmp
ADD llvm-install.sh ./llvm-install.sh
ADD llvm-select.sh ./llvm-select.sh
RUN ./llvm-install.sh 18 all
RUN ./llvm-select.sh 18 18
RUN ./llvm-install.sh 19 all
RUN ./llvm-select.sh 19 99
# +---------------------------------------------------------------------------+
# | DOXYGEN BUILD (PARALLEL)
# +---------------------------------------------------------------------------+
FROM llvm AS doxygen
WORKDIR /tmp
RUN mkdir doxygen-Release
RUN mkdir doxygen-Release/build
COPY cached-download.sh .
ARG DOXYGEN_VERSION=1_13_2
COPY doxygen-Release_${DOXYGEN_VERSION}.sha512.txt .
RUN --mount=type=cache,target=/doxygen-download \
./cached-download.sh \
--cache-target "/doxygen-download" \
--download-url "https://github.com/doxygen/doxygen/archive/refs/tags/Release_${DOXYGEN_VERSION}.tar.gz" \
--download-to-file "/doxygen-download/doxygen-Release_${DOXYGEN_VERSION}.tar.gz" \
--checksums "/tmp/doxygen-Release_${DOXYGEN_VERSION}.sha512.txt" \
--tar-args "--strip-components=1" \
--unpack-dir "/tmp/doxygen-Release"
WORKDIR /tmp/doxygen-Release/build
RUN cmake -G "Ninja" -Dbuild_parse:BOOL=ON ..
RUN cmake --build .
RUN cmake --install .
WORKDIR /tmp
RUN rm -rf doxygen-Release
# +---------------------------------------------------------------------------+
# | GCC::native
# +---------------------------------------------------------------------------+
FROM doxygen AS gcc-select
WORKDIR /tmp
ADD gcc-select.sh ./gcc-select.sh
RUN ./gcc-select.sh 7 7
RUN ./gcc-select.sh 10 10
RUN ./gcc-select.sh 11 11
RUN ./gcc-select.sh 12 12
RUN ./gcc-select.sh 13 99
RUN update-alternatives --display gcc
# +---------------------------------------------------------------------------+
# | arm-none-eabi-gcc
# +---------------------------------------------------------------------------+
FROM gcc-select AS arm-none-eabi-arm64
ARG GCC_HOST_VERSION=aarch64
FROM gcc-select AS arm-none-eabi-amd64
ARG GCC_HOST_VERSION=x86_64
FROM arm-none-eabi-${TARGETARCH} AS arm-none-eabi
WORKDIR /tmp
COPY cached-download.sh .
ARG ARM_NONE_EABI_VERSION=14.2.rel1
ARG ARM_NONE_EABI_CHECKSUM_FILE=arm-gnu-toolchain-${ARM_NONE_EABI_VERSION}-${GCC_HOST_VERSION}-arm-none-eabi.tar.xz.sha256asc
COPY ${ARM_NONE_EABI_CHECKSUM_FILE} .
RUN --mount=type=cache,target=/arm-none-eabi-download \
./cached-download.sh \
--cache-target "/arm-none-eabi-download" \
--download-url "https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_NONE_EABI_VERSION}/binrel/arm-gnu-toolchain-${ARM_NONE_EABI_VERSION}-${GCC_HOST_VERSION}-arm-none-eabi.tar.xz" \
--download-to-file "/arm-none-eabi-download/arm-gnu-toolchain-${ARM_NONE_EABI_VERSION}-${GCC_HOST_VERSION}-arm-none-eabi.tar.xz" \
--checksums "/tmp/${ARM_NONE_EABI_CHECKSUM_FILE}" \
--algorithm 256 \
--unpack-dir "/opt"
ADD arm-none-eabi-gcc-select.sh ./arm-none-eabi-gcc-select.sh
RUN ./arm-none-eabi-gcc-select.sh 1 /opt/arm-gnu-toolchain-${ARM_NONE_EABI_VERSION}-${GCC_HOST_VERSION}-arm-none-eabi/bin/
RUN update-alternatives --display arm-none-eabi-gcc
# +---------------------------------------------------------------------------+
# | GCC::native
# +---------------------------------------------------------------------------+
FROM arm-none-eabi AS jlink
WORKDIR /tmp
# From the forum: https://forum.segger.com/index.php/Thread/8953-SOLVED-J-Link-Linux-installer-fails-for-Docker-containers-Error-Failed-to-update/
ADD JLink_Linux_V816_${TARGETARCH}.deb ./JLink_Linux_V816.deb
RUN apt-get -y install libxcb-render-util0 libxcb-icccm4 libxcb-keysyms1 libxcb-image0 libxkbcommon0 libxkbcommon-x11-0
RUN dpkg --unpack JLink_Linux_V816.deb \
&& rm -f /var/lib/dpkg/info/jlink.postinst
RUN dpkg --configure jlink
RUN apt install -yf
RUN echo "export PATH=/opt/SEGGER/JLink:$PATH" >> ~/.bashrc
RUN rm JLink_Linux_V816.deb
# +---------------------------------------------------------------------------+
# | INSTALL PYTHON STUFF
# +---------------------------------------------------------------------------+
FROM jlink AS python
WORKDIR /tmp
RUN apt-get -y install pipx
ENV PIPX_HOME=/opt/pipx
ENV PIPX_BIN_DIR=/usr/local/bin
RUN echo "export PATH=$PIPX_HOME:$PIPX_BIN_DIR:$PATH" >> ~/.bashrc
RUN pipx install cowsay
RUN pipx install tox
RUN pipx install nox
RUN pip install --break-system-packages gcovr
RUN pipx install yakut
RUN cowsay -t moo
RUN git clone --depth 1 https://github.com/OpenCyphal/public_regulated_data_types.git ~/public_regulated_data_types
# +---------------------------------------------------------------------------+# LEAVE THE WORKDIR AS /repo
# LEAVE THE WORKDIR AS /repo
WORKDIR /repo