Skip to content

Instantly share code, notes, and snippets.

@gyulkkajo
Last active May 6, 2020 01:31
Show Gist options
  • Save gyulkkajo/8dc7bf4bab3d281cb3bd5e6a3ad8e55a to your computer and use it in GitHub Desktop.
Save gyulkkajo/8dc7bf4bab3d281cb3bd5e6a3ad8e55a to your computer and use it in GitHub Desktop.
Docker: Local build environment for Ubuntu 16.04

Local build environment with Docker

A purpose of this image is to make a build environement of Ubuntu 16.04 or others... To build some platform, it needs to be built on specific version of ubuntu. For better experience, the image mounts /home directory on running container. With this, it will share every outputs between the host and a running container.

#!/bin/bash
echo "Build docker image"
echo "UID=$UID, USER=$USER"
sudo docker build --build-arg uid=$UID --build-arg user=$USER -t build_env .
FROM ubuntu:16.04
MAINTAINER [email protected]
RUN apt-get -y update
RUN apt-get -y install python3 bzip2 g++-multilib gcc-multilib gzip tar wget bison build-essential chrpath diffstat gawk git language-pack-en libglib2.0 python2.7 python3 python3-jinja2 python-minimal texi2html texinfo time tig bc libxml2-utils unzip zip libssl-dev vim tree
ARG user
ARG uid
RUN useradd -s /bin/bash $user -u $uid
USER $user
#!/bin/bash
sudo docker run -it --network=host --user $UID \
--mount type=bind,source=/home,target=/home \
build_env \
/bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment