[embug] Re: Yocto build with Docker containers

  • From: DI Andreas Auer <andreas.auer@xxxxxxxxxxxx>
  • To: embug@xxxxxxxxxxxxx
  • Date: Tue, 7 Jan 2020 13:27:04 +0100

Hello.

I'm using a Docker container to build Yocto because building Yocto is currently not working on a non-LTS Ubuntu version larger than 18.04.

I attached a Dockerfile which I used to create the environment. I use it interactively but it may also be a good starting point for an automatic build.
The Yocto files are on my host machine and I bind them to some directory in the Docker container.

I used https://hub.docker.com/r/gmacario/build-yocto/dockerfile as a reference for my Docker file (it's basically the same but with another Ubuntu version).

BR
Andreas

Am 07.01.20 um 13:15 schrieb Ivan Debelec:

Hello all,

i would like to raise one question related to Yocto build with Docker containers...
So building Yocto images in some fixed Docker image.
How, what, where, why not??

If some of you have some practical experience, documentation, interesting articles, videos, or whatever you think is beneficial, i would be very happy to discuss this topic...

Thanks,
see you tomorrow...



--
Embedded Microtec
Hardware Design | Software Design | Smartphone Apps

DI Andreas Auer
Münzgrabenstraße 168/4
8010 Graz, Austria

VAT-ID: ATU66483566
mobile: +43 650 8123818
web   : www.emicrotec.at
email : andreas.auer@xxxxxxxxxxxx
FROM ubuntu:18.04

ENV DEBIAN_FRONTENV noninteractive

RUN apt-get update && apt-get -y upgrade

# Required Packages for the Host Development System

http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#required-packages-for-the-host-development-system
RUN apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib 
g++-multilib \
     build-essential chrpath socat cpio python python3 python3-pip 
python3-pexpect \
     apt-utils tmux xz-utils debianutils iputils-ping libncurses5-dev

# Additional host packages required by poky/scripts/wic
RUN apt-get install -y curl dosfstools mtools parted syslinux tree zip

# Add "repo" tool (used by many Yocto-based projects)
RUN curl //storage.googleapis.com/git-repo-downloads/repo ;> 
/usr/local/bin/repo
RUN chmod a+x /usr/local/bin/repo

# Create user "jenkins"
RUN id jenkins 2>/dev/null || useradd --uid 1000 --create-home jenkins

# Create a non-root user that will perform the actual build
RUN id build 2>/dev/null || useradd --uid 30000 --create-home build
RUN apt-get install -y sudo
RUN echo "build ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers

# Fix error "Please use a locale setting which supports utf-8."
# See https://wiki.yoctoproject.org/wiki/TipsAndTricks/ResolvingLocaleIssues
RUN apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
        echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
        dpkg-reconfigure --frontend=noninteractive locales && \
        update-locale LANG=en_US.UTF-8

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

USER build
WORKDIR /home/build
CMD "/bin/bash"

# EOF

Other related posts: