Skip to content

Instantly share code, notes, and snippets.

@peterleif
Created August 5, 2019 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterleif/fe79860dfd6b584c94ac355b74f25e2b to your computer and use it in GitHub Desktop.
Save peterleif/fe79860dfd6b584c94ac355b74f25e2b to your computer and use it in GitHub Desktop.
Yocto build dockerfile based on Ubuntu 16.04
# To build:
# docker build --no-cache --build-arg "host_uid=$(id -u)" --build-arg "host_gid=$(id -g)" --tag "yocto:latest" .
# GID and UID are needed to obtain access permission to mounted shared directory
FROM ubuntu:16.04
ENV DEBIAN_FRONTENV noninteractive
# Add the 32-bit arch for compat libraries
RUN dpkg --add-architecture i386
# 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 update && apt-get install -y \
gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm
# Other packages
RUN apt-get install -y \
locales \
sudo curl libssl-dev \
strace ltrace \
groff ghostscript txt2man \
libstdc++6:i386 \
dosfstools mtools parted syslinux tree zip \
sed cvs subversion coreutils texi2html \
docbook-utils python-pysqlite2 help2man desktop-file-utils \
libgl1-mesa-dev libglu1-mesa-dev mercurial lzop asciidoc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Add "repo" tool (used by many Yocto-based projects)
RUN curl http://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
RUN chmod a+x /usr/local/bin/repo
ARG host_uid=1000
ARG host_gid=1000
# Create a non-root user that will perform the actual build
RUN groupadd -g ${host_gid} build \
&& useradd -u ${host_uid} -g ${host_gid} -ms /bin/bash --create-home build \
&& usermod -a -G sudo build \
&& usermod -a -G users build
# Locales
RUN dpkg-reconfigure locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment