Skip to content

Commit

Permalink
Adding Sudips docker container and usage description to the repositor…
Browse files Browse the repository at this point in the history
…y. (elisa-tech#22)

Will be referenced in the meta-elisa readme.

Signed-off-by: Jochen Kall <[email protected]>
  • Loading branch information
Jochen-Kall authored Apr 1, 2022
1 parent da4cfe0 commit db6427e
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 0 deletions.
97 changes: 97 additions & 0 deletions Docker_container/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Introduction
The ELISA Automotive WG docker container bundles everything needed to build the telltale example use case.
This eliminates problems arising from individual build systems by design and helps us with troubleshooting in case of problems.
The Container also contains a premade script taking care of the setup steps.
# Prerequisites and Installation
Install Docker:
--------------

Install docker from your distro or you can follow instructions at https://docs.docker.com/engine/install/


Build the docker image after installing docker:
----------------------------------------------

$ docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t elisa -f elisa.dockerfile .

**Note**:
There is a '.' at the end of the command which is required.

# Initial Setup and running the ELISA container
Initial compulsory step before setup: Create your working directory and give it a home folder:
-------------------------

$ mkdir -p elisa/home
$ cd elisa
$ docker run -it --rm -v $PWD:/src --workdir /src elisa

After the above commands you should be inside the docker container in a folder named '/src'.

For setup you can either use the easy way or the expert way.

Setup step (the easy way):
-------------------------

$ setup_elisa.sh
$ cd home/AGL/koi/

The above command will ask you to enter your name and email and then will configure everything and will also clone the required source code at elisa/home/AGL/koi folder.


Setup step (the expert way):
---------------------------

From AGL:

$ export AGL_TOP=$HOME/AGL
$ echo 'export AGL_TOP=$HOME/AGL' >> $HOME/.bashrc
$ mkdir -p $AGL_TOP
$ mkdir -p $HOME/bin
$ export PATH=$HOME/bin:$PATH
$ echo 'export PATH=$HOME/bin:$PATH' >> $HOME/.bashrc
$ curl https://storage.googleapis.com/git-repo-downloads/repo > $HOME/bin/repo
$ chmod a+x $HOME/bin/repo
$ cd $AGL_TOP
$ mkdir koi
$ cd koi

The next two commands (Setting your name and email adress for use by GIT) are not documented in AGL but needed before 'repo' can be used.

$ git config --global user.email "[email protected]"
$ git config --global user.name "Your Name"

Replace the above examples with your actual email and name.

Last two commands from AGL:
--------------------------

$ repo init -b koi -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
$ repo sync

Instructions from Elisa:
-----------------------

$ git clone https://github.com/elisa-tech/meta-elisa.git

# Building and Rebuilding

Steps to build:
--------------

$ source meta-agl/scripts/aglsetup.sh -f elisa-cluster-demo
$ bitbake elisa-cluster-demo-platform

You will be still inside the container untill you give the command 'exit'.

**NOTE**:

Everything that was cloned or built inside docker will also be available from the host under the folder elisa/home.
After the first run, if you want to build again then most of the above steps are not needed.
Only the following should be sufficient.

$ cd elisa
$ docker run -it --rm -v $PWD:/src --workdir /src elisa
$ cd $AGL_TOP/koi
$ source meta-agl/scripts/aglsetup.sh -f elisa-cluster-demo
$ bitbake elisa-cluster-demo-platform
$ exit
49 changes: 49 additions & 0 deletions Docker_container/elisa.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM debian:buster-slim

ARG DEBIAN_FRONTEND=noninteractive
RUN set -x && apt-get update && apt-get upgrade -y \
&& apt-get install -y curl python\
gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat libsdl1.2-dev xterm \
cpio file locales

RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen en_US.UTF-8
RUN echo "#!/bin/bash\n\nif [ ! -d /src/home ]; then\n\tmkdir /src/home\nfi\n\n/bin/bash" > /bin/start.sh
RUN chmod a+x /bin/start.sh
RUN echo "#!/bin/bash \n\n\
if [ ! -e \$HOME/.gitconfig ]; then\n\
echo \"Please enter your name:\"\n\
read name\n\
echo \"Thanks \${name}. Please enter your email:\"\n\
read email\n\
git config --global user.email \"\$email\"\n\
git config --global user.name \"\$name\"\n\
fi\n\
ln=\`cat \$HOME/.bashrc | grep AGL_TOP | wc -l\`\n\
if [ \$ln -eq 0 ]; then\n\
echo 'export AGL_TOP=\$HOME/AGL' >> \$HOME/.bashrc\n\
fi\n\
if [ ! -f \$HOME/bin/repo ]; then\n\
mkdir -p \$HOME/bin\n\
export PATH=\$HOME/bin:\$PATH\n\
echo 'export PATH=\$HOME/bin:\$PATH' >> \$HOME/.bashrc\n\
curl https://storage.googleapis.com/git-repo-downloads/repo > \$HOME/bin/repo\n\
chmod a+x \$HOME/bin/repo\n\
fi\n\
export AGL_TOP=\$HOME/AGL\n\
if [ ! -d \$AGL_TOP/koi ]; then\n\
mkdir -p \$AGL_TOP/koi\n\
cd \$AGL_TOP/koi\n\
repo init -b koi -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo\n\
repo sync\n\
git clone https://github.com/elisa-tech/meta-elisa.git\n\
fi" > /bin/setup_elisa.sh
RUN chmod a+x /bin/setup_elisa.sh

ARG UNAME=elisa
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -M -u $UID -g $GID -o -s /bin/bash -d /src/home $UNAME
USER $UNAME
CMD /bin/start.sh

0 comments on commit db6427e

Please sign in to comment.