Skip to content

Instantly share code, notes, and snippets.

@Micrified
Created April 28, 2021 15:30
Show Gist options
  • Save Micrified/e0273db2a894c9031a3b19ff477b9569 to your computer and use it in GitHub Desktop.
Save Micrified/e0273db2a894c9031a3b19ff477b9569 to your computer and use it in GitHub Desktop.
Docker container for Hedon
# Dockerfile for Hedon Embedded Linux applications
# Ubuntu version (Select in accordance with Variscite Yocto ~ 5.4 Zeus)
FROM ubuntu:18.04
# Export environment variable for time zone
#RUN DEBIAN_FRONTEND="noninteractive" TZ="Europe/Amsterdam" apt-get -y install tzdata
ENV DEBIAN_FRONTEND "noninteractive"
ENV TZ "Europe/Amsterdam"
# Requied packages for installing Yocto (see MegaManual section 1.2.1)
# Locales is added for next step
RUN echo "Installing packages required by Yocto ..."
RUN apt-get update && apt-get -y install 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 \
python3-git \
python3-jinja2 \
libegl1-mesa \
libsdl1.2-dev \
pylint3 \
xterm \
tar \
locales \
sudo
# Required packages by Variscite
RUN echo "Installing packages required by Variscite ..."
RUN apt-get update --fix-missing && apt-get -y install autoconf \
libtool \
libglib2.0-dev \
libarchive-dev \
sed \
cvs \
subversion \
coreutils \
texi2html \
docbook-utils \
python-pysqlite2 \
help2man \
make \
gcc \
g++ \
desktop-file-utils \
libgl1-mesa-dev \
libglu1-mesa-dev \
mercurial \
automake \
groff \
curl \
lzop \
asciidoc \
u-boot-tools \
dos2unix \
mtd-utils \
pv \
libncurses5 \
libncurses5-dev \
libncursesw5-dev \
libelf-dev \
zlib1g-dev \
bc \
rename
# Ubuntu internally symlinks bash to the dash shell. This is adjusted to point
# to real bash as follows:
RUN echo "Switching Ubuntu dash back to bash ..."
RUN rm /bin/sh && ln -s bash /bin/sh
# Designate system with UTF8-capable locale
RUN echo "Setting UTF-8 capable locale ..."
RUN locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
# Set the name for the build user and build group (Hedon)
ENV USER_NAME hedon
ENV PROJECT hedon
RUN echo "Set username to ${USER_NAME} and project to ${USER_NAME}"
# Install Yocto
RUN echo "Installing Yocto as per Variscite guidelines ..."
RUN mkdir /opt/yocto
RUN curl https://commondatastorage.googleapis.com/git-repo-downloads/repo > /opt/yocto/repo
RUN chmod a+x /opt/yocto/repo
RUN export PATH=$PATH:/opt/yocto/
# Prepare for host and group user ID to be passed in as arguments to the build
# command for docker. These are then set as the same IDs within the docker
# container. This enables docker to access host directories
RUN echo "Adding (gid: ${host_gid}, uid: ${host_uid}) as group and user ..."
ARG host_uid=1001
ARG host_gid=1001
RUN groupadd -g $host_gid $USER_NAME && useradd -g $host_gid -m -s /bin/bash -u $host_uid $USER_NAME
# Switch to use the docker-based user
RUN echo "(Switching to user: ${USER_NAME}) ..."
USER $USER_NAME
# Set directory
WORKDIR /opt/yocto-projects-$USER_NAME/
# TODO: Install Hedon Yocto applications and configure/patch them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment