How To Add IAR to MICROEJ SDK Docker Image
This document presents how to create a Dockerfile with MICROEJ SDK version 5.x and Cross-platform Build Tools for Arm to build a MicroEJ application. You can use this image in your automated CI.
Prerequisites
A recent version of IAR BXARM and its user licence.
This training was tested with MICROEJ SDK 5.8.1-jdk11
, IAR 9.30.1
, and Docker 24.0.6
.
Create the Dockerfile
Here is our final Dockerfile. We will explain each specific step below.
FROM microej/sdk:5.8.1-jdk11 USER root SHELL ["/bin/bash", "-c"] ARG IAR_BXARM_VERSION=9.30.1 ARG IAR_BXARM_PACKAGE="bxarm-$IAR_BXARM_VERSION.deb" COPY ressources/$IAR_BXARM_PACKAGE /tmp/$IAR_BXARM_PACKAGE RUN apt-get update && apt-get install sudo libsqlite3-0 libxml2 tzdata dos2unix /tmp/$IAR_BXARM_PACKAGE -y && \ apt-get clean autoclean autoremove && rm -rf /var/lib/apt/lists/* /tmp/*.deb ENV PATH="/opt/iarsystems/bxarm/arm/bin/:/opt/iarsystems/bxarm/common/bin/:$PATH" ENV IAR_LICENSE_SERVER=$IAR_LICENSE_SERVER_IP # Set workdir WORKDIR ${HOME} ADD run.sh /run.sh RUN chmod a+x /run.sh # Good practice, switch back to user. USER ${user} ENTRYPOINT ["/run.sh"]
In a new directory create a file named
Dockerfile
.We use MICROEJ SDK base image, they are available on docker hub. In your Dockerfile add this code:
FROM microej/sdk:5.8.1-jdk11
Add IAR BXARM deb package in a directory named
resources
.Add the package info to your Dockerfile (update the version with the one you want to use):
ARG IAR_BXARM_VERSION=9.30.1 ARG IAR_BXARM_PACKAGE="bxarm-$IAR_BXARM_VERSION.deb"
Copy the package to a temporary directory.
COPY ressources/$IAR_BXARM_PACKAGE /tmp/$IAR_BXARM_PACKAGE
Install this package along with any others required packages.
RUN apt-get update && apt-get install sudo libsqlite3-0 libxml2 tzdata dos2unix /tmp/$IAR_BXARM_PACKAGE -y && \ apt-get clean autoclean autoremove && rm -rf /var/lib/apt/lists/* /tmp/*.deb
Set IAR path and license server address:
ENV PATH="/opt/iarsystems/bxarm/arm/bin/:/opt/iarsystems/bxarm/common/bin/:$PATH" ENV IAR_LICENSE_SERVER=$IAR_LICENSE_SERVER_IP
Finally create a
run.sh
script with the following content:lightlicensemanager setup -s $IAR_LICENSE_SERVER exec "$@"