Skip to content

Instantly share code, notes, and snippets.

@misaalanshori
Last active August 4, 2023 13:38
Show Gist options
  • Save misaalanshori/8ef4fb01b5c2503201ec949dad64b834 to your computer and use it in GitHub Desktop.
Save misaalanshori/8ef4fb01b5c2503201ec949dad64b834 to your computer and use it in GitHub Desktop.
Ubuntu Docker for building Buildroot (Specifically for the ESP32-S3)
version: '3'
services:
ubuntu_container:
image: ubuntubuildenv
container_name: ubuntud
volumes:
- ./ubuntuhome:/home/egg
- /dev:/dev
command: ["/bin/bash"]
stdin_open: true
tty: true
# Use Ubuntu 22.04 as the base image
FROM ubuntu:22.04
# Install required packages and cache them
# Some of these packages might be unnecessary, but whatever...
RUN apt-get update && apt-get install -y \
git wget curl tar make cmake gcc g++ python3 libncurses-dev build-essential \
libssl-dev bc xz-utils unzip rsync flex bison gettext libglib2.0-dev libfdt-dev \
libpixman-1-dev zlib1g-dev autoconf texinfo help2man gperf libtool-bin gawk \
python3-pip tmux sudo
# Clean up the package cache to reduce the image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a user named "user" and set sudo privileges
RUN useradd -m -s /bin/bash egg && \
echo "egg ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Switch to the "user" from now on
USER egg
# Set up the user home directory
WORKDIR /home/egg
RUN sudo chown -R egg:egg /home/egg
# Define the entry point
CMD ["/bin/bash"]
docker build -t ubuntubuildenv .
docker compose up -d
docker exec -it ubuntud /bin/bash
# Run in the container, seems to be needed. Possibly because the home folder is mounted as a folder in the host
sudo chown -R egg:egg /home/egg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment