From 2a3aca70e0a214ab8ec5afc0600ab3949d5a5ca0 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Sun, 15 Mar 2020 18:23:28 +0100 Subject: Adding Docker container files for Ubuntu 19.10. Adding a 'build' and 'test' Docker container, such that users/developers can create a clean and reproducible environment for testing and building/releasing SCons on their machines. --- docker/docker.rst | 101 +++++++++++++++++++++ docker/ubuntu19.10/build/Dockerfile | 17 ++++ docker/ubuntu19.10/build/build_image.sh | 16 ++++ docker/ubuntu19.10/build/docker-compose.yml | 22 +++++ docker/ubuntu19.10/build/readme.rst | 43 +++++++++ docker/ubuntu19.10/build/start_build_shell.sh | 18 ++++ .../ubuntu19.10/build/startup/setup_container.sh | 10 ++ docker/ubuntu19.10/build/stop_build_shell.sh | 17 ++++ docker/ubuntu19.10/test/Dockerfile | 10 ++ docker/ubuntu19.10/test/build_image.sh | 16 ++++ docker/ubuntu19.10/test/docker-compose.yml | 22 +++++ docker/ubuntu19.10/test/readme.rst | 43 +++++++++ docker/ubuntu19.10/test/start_test_shell.sh | 18 ++++ docker/ubuntu19.10/test/startup/setup_container.sh | 10 ++ docker/ubuntu19.10/test/stop_test_shell.sh | 17 ++++ 15 files changed, 380 insertions(+) create mode 100644 docker/docker.rst create mode 100644 docker/ubuntu19.10/build/Dockerfile create mode 100755 docker/ubuntu19.10/build/build_image.sh create mode 100644 docker/ubuntu19.10/build/docker-compose.yml create mode 100644 docker/ubuntu19.10/build/readme.rst create mode 100755 docker/ubuntu19.10/build/start_build_shell.sh create mode 100755 docker/ubuntu19.10/build/startup/setup_container.sh create mode 100755 docker/ubuntu19.10/build/stop_build_shell.sh create mode 100644 docker/ubuntu19.10/test/Dockerfile create mode 100755 docker/ubuntu19.10/test/build_image.sh create mode 100644 docker/ubuntu19.10/test/docker-compose.yml create mode 100644 docker/ubuntu19.10/test/readme.rst create mode 100755 docker/ubuntu19.10/test/start_test_shell.sh create mode 100755 docker/ubuntu19.10/test/startup/setup_container.sh create mode 100755 docker/ubuntu19.10/test/stop_test_shell.sh diff --git a/docker/docker.rst b/docker/docker.rst new file mode 100644 index 0000000..5845486 --- /dev/null +++ b/docker/docker.rst @@ -0,0 +1,101 @@ +================================== +Basic working with docker registry +================================== + +Install required packages +========================= + +Ensure that the following packages are installed on your local machine:: + + docker.io >= v18.09 + docker-compose >= v1.17 + +User and group +============== + +Add your local user to the `docker` group, e.g. by:: + + sudo usermod -aG docker ${USER} + +. After this step logout and login again, so that the change has been applied and the new group +is in effect. + + +Configuring docker daemon +========================= + +Reconfigure by editing `/etc/docker/daemon.json` as *root*:: + + { + "debug": false + } + +. + +Then reboot the machine or simply restart the daemon as *root* with:: + + sudo systemctl restart docker.service + +To check that the docker daemon was configured correctly, do a:: + + docker info + +which should result in an output similar to:: + + Client: + Debug Mode: false + + Server: + Containers: 0 + Running: 0 + Paused: 0 + Stopped: 0 + Images: 0 + Server Version: 19.03.6 + Storage Driver: overlay2 + Backing Filesystem: extfs + Supports d_type: true + Native Overlay Diff: true + Logging Driver: json-file + Cgroup Driver: cgroupfs + Plugins: + Volume: local + Network: bridge host ipvlan macvlan null overlay + Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog + Swarm: inactive + Runtimes: runc + Default Runtime: runc + Init Binary: docker-init + containerd version: + runc version: + init version: + Security Options: + apparmor + seccomp + Profile: default + Kernel Version: 4.15.0-88-generic + Operating System: Ubuntu 18.04.4 LTS + OSType: linux + Architecture: x86_64 + CPUs: 4 + Total Memory: 6.997GiB + Name: ubuntu + ID: H2N5:VOZ6:UO6V:B36O:MD6Q:7GXR:M4QY:7EBB:NC6R:HQCQ:7ARF:CZBH + Docker Root Dir: /var/lib/docker + Debug Mode: false + Registry: https://index.docker.io/v1/ + Labels: + Experimental: false + Insecure Registries: + 127.0.0.0/8 + Live Restore Enabled: false + + WARNING: No swap limit support + +Setup resolv.conf if necessary +=============================== + +Docker uses `etc/resolv.conf` DNS information and passes that automatically to containers. If the file is not configured +properly or if entries are not valid, the server adds automatically public Google DNS nameservers +(8.8.8.8 and 8.8.4.4) to the container's DNS configuration. + diff --git a/docker/ubuntu19.10/build/Dockerfile b/docker/ubuntu19.10/build/Dockerfile new file mode 100644 index 0000000..38f4dd7 --- /dev/null +++ b/docker/ubuntu19.10/build/Dockerfile @@ -0,0 +1,17 @@ +# Building an SCons Release Build image under Ubuntu 19.10 +FROM ubuntu:19.10 + +LABEL version="0.0.1" maintainer="Dirk Baechle " description="SCons Release Build, based on an Ubuntu 19.10" + +# Install additional packages +RUN apt-get update && apt-get -y install git python3-lxml fop libfontbox-java python3-dev rpm tar curl lynx xterm vim vim-common nano sudo + +# Install hyphenation patterns for FOP +RUN mkdir /opt/offo && cd /opt/offo && curl -L --output offo-hyphenation-compiled.zip https://sourceforge.net/projects/offo/files/offo-hyphenation/2.2/offo-hyphenation-compiled.zip/download && unzip offo-hyphenation-compiled.zip && cp offo-hyphenation-compiled/fop-hyph.jar /usr/share/fop/ + +# Epydoc can be installed via pip3, but it doesn't seem to work properly. +# For the moment we don't install it and might replace it with Sphinx later... +# RUN apt-get -y install python3-pip && pip3 install epydoc + +CMD ["/bin/bash"] + diff --git a/docker/ubuntu19.10/build/build_image.sh b/docker/ubuntu19.10/build/build_image.sh new file mode 100755 index 0000000..29e0f7e --- /dev/null +++ b/docker/ubuntu19.10/build/build_image.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# store starting working directory +OLD_WD=$PWD + +# determine working directory of shell script +WD=$(dirname "$(readlink -f "$0")") + +cd $WD + +# call docker build passing any other build options (command line options may override!) +docker build --network=host --file Dockerfile \ + -t scons-build-ubuntu19.10:latest -t scons-build-ubuntu19.10:0.0.1 "$@" . + +cd $OLD_WD + diff --git a/docker/ubuntu19.10/build/docker-compose.yml b/docker/ubuntu19.10/build/docker-compose.yml new file mode 100644 index 0000000..aa34bac --- /dev/null +++ b/docker/ubuntu19.10/build/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3' + +services: + build: + image: scons-build-ubuntu19.10:latest + restart: always + environment: + - DISPLAY + - HOME + volumes: + - /home:/home + - /tmp:/tmp + - /etc/sudoers:/etc/sudoers:ro + - /etc/passwd:/etc/passwd:ro + - /etc/shadow:/etc/shadow:ro + - /etc/group:/etc/group:ro + - ./startup:/startup + container_name: SCons_Build_Ubuntu19.10 + entrypoint: /startup/setup_container.sh + user: $DOCKERUID:$DOCKERGID + working_dir: $HOME + diff --git a/docker/ubuntu19.10/build/readme.rst b/docker/ubuntu19.10/build/readme.rst new file mode 100644 index 0000000..b21d52c --- /dev/null +++ b/docker/ubuntu19.10/build/readme.rst @@ -0,0 +1,43 @@ +================================== +Image for building/releasing SCons +================================== + +This folder contains the files and scripts that can be used to +build and release SCons, based on an Ubuntu 19.10. + +Building the image +================== + +Build the local docker image by calling:: + + ./build_image.sh + +This will download the base image and install the required additional packages. + +Starting the image +================== + +Is done via ``docker-compose`` so make sure you have this package installed in your host system. Then call:: + + ./start_build_shell.sh + +which will open a new ``xterm`` with your current user on the host system as default. + +If you need additional setup steps or want to *mount* different folders to the build image, change the +files:: + + docker-compose.yml + ./startup/setup_container.sh + +locally. + + +Stopping the image +================== + +Simply call:: + + ./stop_build_shell.sh + +. + diff --git a/docker/ubuntu19.10/build/start_build_shell.sh b/docker/ubuntu19.10/build/start_build_shell.sh new file mode 100755 index 0000000..6905634 --- /dev/null +++ b/docker/ubuntu19.10/build/start_build_shell.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# store starting working directory +OLD_WD=$PWD + +# determine working directory of shell script +WD=$(dirname "$(readlink -f "$0")") + +cd $WD + +# call docker container with local user +xhost +local:docker +export DOCKERUID=$(id -u) +export DOCKERGID=$(id -g) +docker-compose up -d + +cd $OLD_WD + diff --git a/docker/ubuntu19.10/build/startup/setup_container.sh b/docker/ubuntu19.10/build/startup/setup_container.sh new file mode 100755 index 0000000..f655441 --- /dev/null +++ b/docker/ubuntu19.10/build/startup/setup_container.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Here we can add local setup steps for the finishing touches to our Docker build container. +# This can be setting symbolic links, e.g. +# sudo ln -s /disk2/stuff /stuff +# or triggering further scripts. + +# We start a separate xterm/terminal, such that the container doesn't exit right away... +/usr/bin/xterm + diff --git a/docker/ubuntu19.10/build/stop_build_shell.sh b/docker/ubuntu19.10/build/stop_build_shell.sh new file mode 100755 index 0000000..c0a9707 --- /dev/null +++ b/docker/ubuntu19.10/build/stop_build_shell.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# store starting working directory +OLD_WD=$PWD + +# determine working directory of shell script +WD=$(dirname "$(readlink -f "$0")") + +cd $WD + +# call docker container with local user +export DOCKERUID=$(id -u) +export DOCKERGID=$(id -g) +docker-compose down + +cd $OLD_WD + diff --git a/docker/ubuntu19.10/test/Dockerfile b/docker/ubuntu19.10/test/Dockerfile new file mode 100644 index 0000000..a86947e --- /dev/null +++ b/docker/ubuntu19.10/test/Dockerfile @@ -0,0 +1,10 @@ +# Building an SCons Test image under Ubuntu 19.10 +FROM ubuntu:19.10 + +LABEL version="0.0.1" maintainer="Dirk Baechle " description="SCons Test image, based on an Ubuntu 19.10" + +# Install additional packages +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install git bison cssc cvs flex g++ gcc ghostscript m4 openssh-client openssh-server python3-profiler python3-all-dev pypy-dev rcs rpm openjdk-8-jdk swig texlive-base-bin texlive-extra-utils texlive-latex-base texlive-latex-extra zip xterm vim vim-common nano sudo + +CMD ["/bin/bash"] + diff --git a/docker/ubuntu19.10/test/build_image.sh b/docker/ubuntu19.10/test/build_image.sh new file mode 100755 index 0000000..92649a0 --- /dev/null +++ b/docker/ubuntu19.10/test/build_image.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# store starting working directory +OLD_WD=$PWD + +# determine working directory of shell script +WD=$(dirname "$(readlink -f "$0")") + +cd $WD + +# call docker build passing any other build options (command line options may override!) +docker build --network=host --file Dockerfile \ + -t scons-test-ubuntu19.10:latest -t scons-test-ubuntu19.10:0.0.1 "$@" . + +cd $OLD_WD + diff --git a/docker/ubuntu19.10/test/docker-compose.yml b/docker/ubuntu19.10/test/docker-compose.yml new file mode 100644 index 0000000..1f3777f --- /dev/null +++ b/docker/ubuntu19.10/test/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3' + +services: + build: + image: scons-test-ubuntu19.10:latest + restart: always + environment: + - DISPLAY + - HOME + volumes: + - /home:/home + - /tmp:/tmp + - /etc/sudoers:/etc/sudoers:ro + - /etc/passwd:/etc/passwd:ro + - /etc/shadow:/etc/shadow:ro + - /etc/group:/etc/group:ro + - ./startup:/startup + container_name: SCons_Test_Ubuntu19.10 + entrypoint: /startup/setup_container.sh + user: $DOCKERUID:$DOCKERGID + working_dir: $HOME + diff --git a/docker/ubuntu19.10/test/readme.rst b/docker/ubuntu19.10/test/readme.rst new file mode 100644 index 0000000..d7247d2 --- /dev/null +++ b/docker/ubuntu19.10/test/readme.rst @@ -0,0 +1,43 @@ +======================= +Image for testing SCons +======================= + +This folder contains the files and scripts that can be used to +test SCons, based on an Ubuntu 19.10. + +Building the image +================== + +Build the local docker image by calling:: + + ./build_image.sh + +This will download the base image and install the required additional packages. + +Starting the image +================== + +Is done via ``docker-compose`` so make sure you have this package installed in your host system. Then call:: + + ./start_test_shell.sh + +which will open a new ``xterm`` with your current user on the host system as default. + +If you need additional setup steps or want to *mount* different folders to the test image, change the +files:: + + docker-compose.yml + ./startup/setup_container.sh + +locally. + + +Stopping the image +================== + +Simply call:: + + ./stop_test_shell.sh + +. + diff --git a/docker/ubuntu19.10/test/start_test_shell.sh b/docker/ubuntu19.10/test/start_test_shell.sh new file mode 100755 index 0000000..6905634 --- /dev/null +++ b/docker/ubuntu19.10/test/start_test_shell.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# store starting working directory +OLD_WD=$PWD + +# determine working directory of shell script +WD=$(dirname "$(readlink -f "$0")") + +cd $WD + +# call docker container with local user +xhost +local:docker +export DOCKERUID=$(id -u) +export DOCKERGID=$(id -g) +docker-compose up -d + +cd $OLD_WD + diff --git a/docker/ubuntu19.10/test/startup/setup_container.sh b/docker/ubuntu19.10/test/startup/setup_container.sh new file mode 100755 index 0000000..f655441 --- /dev/null +++ b/docker/ubuntu19.10/test/startup/setup_container.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Here we can add local setup steps for the finishing touches to our Docker build container. +# This can be setting symbolic links, e.g. +# sudo ln -s /disk2/stuff /stuff +# or triggering further scripts. + +# We start a separate xterm/terminal, such that the container doesn't exit right away... +/usr/bin/xterm + diff --git a/docker/ubuntu19.10/test/stop_test_shell.sh b/docker/ubuntu19.10/test/stop_test_shell.sh new file mode 100755 index 0000000..c0a9707 --- /dev/null +++ b/docker/ubuntu19.10/test/stop_test_shell.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# store starting working directory +OLD_WD=$PWD + +# determine working directory of shell script +WD=$(dirname "$(readlink -f "$0")") + +cd $WD + +# call docker container with local user +export DOCKERUID=$(id -u) +export DOCKERGID=$(id -g) +docker-compose down + +cd $OLD_WD + -- cgit v0.12