Skip to content

Instantly share code, notes, and snippets.

@Scott31393
Last active August 27, 2021 15:18
Show Gist options
  • Save Scott31393/c64bf5cc33c0d1c1f80dd7a44b13cb6a to your computer and use it in GitHub Desktop.
Save Scott31393/c64bf5cc33c0d1c1f80dd7a44b13cb6a to your computer and use it in GitHub Desktop.

Basic Dockerfile @alienmind01

FROM crops/poky:ubuntu-18.04
USER root

RUN apt-get install -y vim


RUN dpkg --add-architecture i386


# Install essential Yocto Project host package
RUN  apt-get update && \
   DEBIAN_FRONTEND="noninteractive" apt-get -y install gawk wget git-core diffstat unzip texinfo gcc-multilib \
   build-essential chrpath socat libsdl1.2-dev apt-utils libsdl1.2-dev xterm sed cvs subversion coreutils texi2html \
   docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial \
   autoconf automake groff curl lzop asciidoc locales python-wxtools sudo p7zip-full software-properties-common \
   debconf-utils cpio rsync software-properties-common file bd libncurses5 mtools parted libudev-dev libusb-1.0-0-dev \
       python-linaro-image-tools linaro-image-tools autoconf autotools-dev libsigsegv2 m4 genext2fs expect patchelf


# add repo for python3 support
RUN add-apt-repository ppa:deadsnakes/ppa

# Install utility
RUN  apt-get update && \
   DEBIAN_FRONTEND="noninteractive" apt-get -y install locales sudo p7zip-full software-properties-common \
   debconf-utils vim nano bc python3.8

# Update python
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 && \
   update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2

# Update GCC
RUN apt-get install -y gcc-8 g++-8 && \
   update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7 && \
   update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8


# Set the locale to en_US.UTF-8, because the Yocto build fails without any locale set.
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
ENV DISPLAY :0
#CMD xeyes


# Replace dash with bash
# By default, Ubuntu uses dash as an alias for sh. Dash does not support the source command
# needed for setting up the build environment in CMD. Use bash as an alias for sh.
RUN rm /bin/sh && ln -s bash /bin/sh


# Install the “repo” utility
RUN  curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo \
&& chmod a+x /usr/local/bin/repo


# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


RUN echo "root:root" | chpasswd

Build Dockerfile

DOCKER_BUILDKIT=1 docker build --rm -t test .

Run Docker with SSH Support

docker run --rm -it -v ${PWD}:/workdir -v ~/.ssh:/home/pokyuser/.ssh:ro --workdir=/workdir f5d8b9f941e
ssh-agent
ssh-add ~/.ssh/id_test
ssh -T [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment