From ef2849975c49b4739f0d33e48b636e5a73c8789c Mon Sep 17 00:00:00 2001 From: Jens Nyberg Date: Sat, 4 Apr 2026 15:20:01 +0200 Subject: [PATCH] Update docker build This commit rewrites the ApolloOS build image. If you have a machine with docker installed, running ./docker.sh is now all you need to build ApolloOS. Dockerfile: * New base image is ubuntu 22.04 * Dependencies changed to match dependencies.sh * Removed PS1 manipulations to clean things up docker.sh: * Changed tag name to apollo-os-build:latest * Changed the check if the image already was built. * Container is now run as your own user instead of root. * Now uses ./mkapollo.sh all to build. mkapollo.sh: * Add flag to override ports. This was necesserry in my case because the downloads did not work and since the source was already part of the git source I just pointed it to that directory instead. --- Dockerfile | 59 +++++++++++++++++++++++++++-------------------------- docker.sh | 13 ++++-------- mkapollo.sh | 10 ++++++++- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/Dockerfile b/Dockerfile index 12d0bc6e126..d99cac22562 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,33 @@ -FROM phusion/baseimage:master-amd64 - -LABEL maintainer="Georgios Sokianos " - -# Use baseimage-docker's init system. -CMD ["/sbin/my_init"] +FROM ubuntu:22.04 +WORKDIR /usr/src -RUN dpkg --add-architecture i386; \ - apt-get update && apt-get -y install \ - autoconf ccache make mmake automake cmake \ +RUN apt-get -y update +RUN apt-get -y install \ + autoconf \ + automake \ + bison \ + byacc \ + bzip2 \ + cmake \ + flex \ + gawk \ gcc \ - wget \ - lhasa \ - git subversion mercurial \ - gawk bison flex netpbm genisoimage sshpass \ - python-mako libswitch-perl gperf gcc-multilib g++ \ - patch bzip2 ca-certificates xz-utils \ - libpng-dev zlib1g-dev libxcursor-dev libgl1-mesa-dev libasound2-dev \ - libx11-dev libxext-dev libc6-dev liblzo2-dev libxxf86vm-dev libsdl1.2-dev byacc libxxf86vm1:i386; \ - ln -s /usr/bin/genisoimage /usr/bin/mkisofs; \ - apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; + genisoimage \ + git \ + g++ \ + libc6-dev \ + liblzo2-dev \ + libpng-dev \ + libsdl1.2-dev \ + libx11-dev \ + libxcursor-dev \ + libxext-dev \ + libxxf86vm-dev \ + make \ + mmake \ + netpbm \ + wget +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Add git branch name to bash prompt -RUN sed -i '4c\'"\nparse_git_branch() {\n\ - git branch 2> /dev/null | sed -e \'/^[^*]/d\' -e \'s/* \\\(.*\\\)/ (\\\1)/\'\n\ -}\n" ~/.bashrc; \ - sed -i '43c\'"force_color_prompt=yes" ~/.bashrc; \ - sed -i '57c\'" PS1=\'\${debian_chroot:+(\$debian_chroot)}\\\[\\\033[01;32m\\\]\\\u@\\\h\\\[\\\033[00m\\\]:\\\[\\\033[01;34m\\\]\\\w\\\[\\\033[01;31m\\\]\$(parse_git_branch)\\\[\\\033[00m\\\]\\\$ '" ~/.bashrc; \ - sed -i '59c\'" PS1=\'\${debian_chroot:+(\$debian_chroot)}\\\u@\\\h:\\\w \$(parse_git_branch)\$ \'" ~/.bashrc; -# Clean up APT when done. -RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -WORKDIR /usr/src +CMD ["/bin/bash"] diff --git a/docker.sh b/docker.sh index 01c7620a89d..4d09b9e261d 100755 --- a/docker.sh +++ b/docker.sh @@ -1,15 +1,10 @@ #!/bin/bash -#sudo docker run -it --rm -v "$PWD":/git ubuntu "/bin/bash -c \"apt-get install git-core gcc g++ make cmake gawk bison flex bzip2 netpbm autoconf automake libx11-dev libxext-dev libc6-dev liblzo2-dev libxxf86vm-dev libpng-dev libsdl1.2-dev byacc python-mako libxcursor-dev gcc-multilib\"; /bin/bash" -IMAGE_NAME=apolloos/builder +IMAGE_NAME=apollo-os-build:latest -#Do we have this image already? -DOCKER_IMAGE_COUNT=$(docker image ls | awk -F\ '{ print $1 }' | grep "${IMAGE_NAME} | wc -l") -echo ${DOCKER_IMAGE_COUNT} -if [ "${DOCKER_IMAGE_COUNT}" == "" ] +if [ -z "$(docker images -q "${IMAGE_NAME}")" ] then - docker build -t ${IMAGE_NAME} . + docker build -t "${IMAGE_NAME}" . fi -#Run the docker and start the build -docker run -it --rm -v "$PWD":/usr/src ${IMAGE_NAME} /bin/bash -c "cd /usr/src; ./rebuild_all.sh" +docker run -it --rm -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v "${PWD}":/usr/src -u "$(id -u):$(id -g)" "${IMAGE_NAME}" /bin/bash -c "./mkapollo.sh --ports=/usr/src/bin/Sources all" diff --git a/mkapollo.sh b/mkapollo.sh index 702e3e51f11..6f63aac6b78 100755 --- a/mkapollo.sh +++ b/mkapollo.sh @@ -27,6 +27,7 @@ DEBUG=0 CONFO="" MAKEO="" EXCLUDE=0 +PORTS="" ## END Configuration ## ## BEGIN Beauty Variables ## @@ -48,7 +49,9 @@ setvars () { SRC="${DIR}/${WORK}/src" fi TEST_CFLAGS="" #-I${DIR}/${WORK}" - PORTS="${DIR}/${WORK}/prt" + if [ -z "${PORTS}" ]; then + PORTS="${DIR}/${WORK}/prt" + fi BIN="${DIR}/${WORK}/bin" source ${SRC}/make_dist_config.sh DISTOPTNAME="--enable-dist-name=${DISTRONAME}" @@ -210,6 +213,10 @@ for i in "$@"; do REZ="640x256x4" shift ;; + --ports=*) + PORTS="${i#*=}" + shift + ;; -v|-v1|--vamp) VAMP=1 shift @@ -290,6 +297,7 @@ ${BOLD}mkapollo.sh -- Roll your own ApolloOS image and ROM${NC} -n,--ntsc Select NTSC build -o,--opt=# Select optimization level -p,--pal Select PAL build + --ports Select ports directory -v,--vamp Compile for True Vampires -w,--work= Work directory (will be created if not present) -x,--exclude When wiping, do not save cross compile tools