Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile for building everest core and cross compilation #15

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
15 changes: 15 additions & 0 deletions rasbian-image/docker-compose.everest-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"

services:
everest-core:
container_name: everest-core
build:
dockerfile: "everest-core.dockerfile"
# deploy:
# resources:
# limits:
# cpus: "4"
# memory: "1024M"

stdin_open: true
tty: true
21 changes: 21 additions & 0 deletions rasbian-image/docker-compose.qemu-raspbian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3"
services:
qemu:
container_name: qemu-raspbian
image: qemux/qemu-arm
volumes:
- /path/to/1688039802-2023-06-29-belaybox.img:/storage/boot.iso
environment:
# BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/aarch64/alpine-virt-3.19.1-aarch64.iso"
KVM: "N"
# RAM_SIZE: "2G"
# CPU_CORES: "4"
# DISK_SIZE: "64G"
# devices:
# - /dev/kvm
cap_add:
- NET_ADMIN
ports:
- 8006:8006
stop_grace_period: 2m
restart: on-failure
15 changes: 15 additions & 0 deletions rasbian-image/docker-compose.raspbian-dockerpi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"

services:
raspbian-everest:
container_name: raspbian-everest
image: lukechilds/dockerpi:vm
volumes:
- /path/to/1688039802-2023-06-29-belaybox.img:/sdcard/filesystem.img
# deploy:
# resources:
# limits:
# cpus: "4"
# memory: "1024M"
stdin_open: true
tty: true
15 changes: 15 additions & 0 deletions rasbian-image/docker-compose.raspbian-stretch-everest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"

services:
raspbian-everest:
container_name: raspbian-everest
build:
dockerfile: "raspbian-everest.dockerfile"
# deploy:
# resources:
# limits:
# cpus: "4"
# memory: "1024M"

stdin_open: true
tty: true
63 changes: 63 additions & 0 deletions rasbian-image/everest-core.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
FROM ubuntu:latest

Check warning on line 1 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L1

Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag

RUN apt update && apt-get install sudo curl -y

Check notice on line 3 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L3

Avoid additional packages by specifying `--no-install-recommends`

Check warning on line 3 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L3

Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

# setup clang format
RUN apt install clang-format-12 -y
RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-12 100

# setup nodejs v21
RUN curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash - && sudo apt-get install -y nodejs

Check failure on line 10 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L10

Do not use sudo as it leads to unpredictable behavior. Use a tool like gosu to enforce root

# install dependencies
RUN sudo apt install -y python3-pip git rsync wget cmake doxygen graphviz build-essential clang-tidy cppcheck openjdk-17-jdk \

Check failure on line 13 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L13

Do not use sudo as it leads to unpredictable behavior. Use a tool like gosu to enforce root
libboost-all-dev libssl-dev libsqlite3-dev rfkill libpcap-dev libevent-dev pkg-config libcap-dev zip
# note, removed the following packages from this command: npm docker docker-compose nodejs curl

# install python dependencies
RUN python3 -m pip install --upgrade pip setuptools wheel jstyleson jsonschema

Check warning on line 18 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L18

Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>`

# download EDM source files
RUN git clone https://github.com/EVerest/everest-dev-environment.git

# install EDM
RUN cd everest-dev-environment/dependency_manager && python3 -m pip install .

Check warning on line 24 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L24

Use WORKDIR to switch to a directory

# add /home/USER/.local/bin and CPM_SOURCE_CACHE to $PATH
ENV PATH=$PATH:/home/$(whoami)/.local/bin
ENV CPM_SOURCE_CACHE=$HOME/.cache/CPM

# setup EVerest workspace:
RUN cd everest-dev-environment/dependency_manager && edm init --workspace ~/checkout/everest-workspace

Check warning on line 31 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L31

Use WORKDIR to switch to a directory

# install ev-cli
RUN cd ~/checkout/everest-workspace/everest-utils/ev-dev-tools && python3 -m pip install .

Check warning on line 34 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L34

Use WORKDIR to switch to a directory

# install the required packages for ISO15118 communication
RUN cd ~/checkout/everest-workspace/Josev && python3 -m pip install -r requirements.txt

Check warning on line 37 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L37

Use WORKDIR to switch to a directory

# build EVerest
RUN mkdir -p ~/checkout/everest-workspace/everest-core/build \

Check warning on line 40 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L40

Use WORKDIR to switch to a directory
&& cd ~/checkout/everest-workspace/everest-core/build \
&& cmake .. \
&& make install

# download and untar the bullseye-toolchain
RUN wget http://build.pionix.de:8888/release/toolchains/bullseye-toolchain.tgz && tar xfz bullseye-toolchain.tgz

Check warning on line 46 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L46

Either use Wget or Curl but not both
RUN rm bullseye-toolchain.tgz

# cross-compile by changing the given paths accordingly and build EVerest
RUN cd ~/checkout/everest-workspace/everest-core \

Check warning on line 50 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L50

Use WORKDIR to switch to a directory
&& cmake \
-DCMAKE_TOOLCHAIN_FILE=/bullseye-toolchain/toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=/mnt/user_data/opt/everest \
-S . -B build-cross \
&& make -C build-cross \
&& make DESTDIR=./dist -C build-cross install
# && make -j$(nproc) -C build-cross \
# && make -j$(nproc) DESTDIR=./dist -C build-cross install

RUN cd ~/checkout/everest-workspace/everest-core/build-cross/dist/mnt/user_data/opt/ && \

Check warning on line 60 in rasbian-image/everest-core.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/everest-core.dockerfile#L60

Use WORKDIR to switch to a directory
zip -r /everest.zip everest

ENTRYPOINT ["/bin/bash"]
18 changes: 18 additions & 0 deletions rasbian-image/raspbian-everest.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM raspbian/stretch:latest

Check warning on line 1 in rasbian-image/raspbian-everest.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/raspbian-everest.dockerfile#L1

Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag

# copy everest binaries
COPY everest.zip /everest.zip

# add legacy sources
RUN rm /etc/apt/sources.list
COPY sources.list /etc/apt/sources.list

# install dependencies
RUN apt-get update && apt-get install zip -y

Check notice on line 11 in rasbian-image/raspbian-everest.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/raspbian-everest.dockerfile#L11

Avoid additional packages by specifying `--no-install-recommends`

Check notice on line 11 in rasbian-image/raspbian-everest.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/raspbian-everest.dockerfile#L11

Delete the apt-get lists after installing something

Check warning on line 11 in rasbian-image/raspbian-everest.dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

rasbian-image/raspbian-everest.dockerfile#L11

Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

# unzip everest binaries into the recommended directory
RUN mkdir -p /mnt/user_data/opt/
RUN unzip everest.zip -d /mnt/user_data/opt/
RUN rm everest.zip

ENTRYPOINT ["/bin/sh"]
1 change: 1 addition & 0 deletions rasbian-image/sources.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deb http://legacy.raspbian.org/raspbian/ stretch main contrib non-free rpi firmware