diff options
Diffstat (limited to 'docker')
-rw-r--r-- | docker/Dockerfile | 31 | ||||
-rw-r--r-- | docker/README.md | 38 | ||||
-rwxr-xr-x | docker/entrypoint.sh | 6 | ||||
-rwxr-xr-x | docker/install_packages.sh | 33 | ||||
-rwxr-xr-x | docker/set_up_agl-demo-control-panel.sh | 17 |
5 files changed, 125 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..74bec62 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,31 @@ +FROM debian:bookworm-slim as base + +ENV DEBIAN_FRONTEND=noninteractive + +# If you have a running instance of squid-deb-proxy or apt-cacher-ng this will +# allow you to use it an avoid wasting bandwith every time you create an image. +ARG httpproxy +ARG httpsproxy +ENV http_proxy=$httpproxy +ENV https_proxy=$httpproxy + +COPY install_packages.sh /tmp +RUN /tmp/install_packages.sh +COPY set_up_agl-demo-control-panel.sh /tmp +RUN /tmp/set_up_agl-demo-control-panel.sh + +COPY entrypoint.sh /opt + +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +# Clean proxy variables. +ENV http_proxy= +ENV https_proxy= + +# Set the locale +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 + +ENTRYPOINT /opt/entrypoint.sh
\ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..29f5e5a --- /dev/null +++ b/docker/README.md @@ -0,0 +1,38 @@ +# Docker container for AGL Demo Control Panel + +## Building + +In this directory run: + +```bash +$ docker build \ + --pull -t agl-demo-control-panel . +``` +Or, if you have an apt cacher like squid-deb-proxy: + +```bash +$ docker build \ + --build-arg httpproxy="http://<proxy IP>:<proxy port>/" \ + --build-arg httpsproxy="https://<proxy IP>:<proxy port>/" \ + --pull -t agl-demo-control-panel . +``` + +## Running the container + +```bash +$ docker run -ti --rm --network host agl-demo-control-panel +``` + +If you plan to use this frequently do consider adding it as an alias into your ~/.bashrc! + +Edit ~/.bashrc and add this line: + +```bash +alias docker_agl-demo-control-panel='docker run -ti --rm --network host agl-demo-control-panel' +``` + +Then source ~/.bashrc or log out and in and simply run: + +```bash +$ docker_agl-demo-control-panel +``` diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..82da5c3 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -x + +cd /opt/agl-demo-control-panel +QT_QPA_PLATFORM="vnc:size=1920x1080" python3 -u main.py
\ No newline at end of file diff --git a/docker/install_packages.sh b/docker/install_packages.sh new file mode 100755 index 0000000..4e94a37 --- /dev/null +++ b/docker/install_packages.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Exit as soon as something fails. +set -e + +# The idea behind doing all this in a script is to reduce the final size of the +# docker image, as all this will only generate one layer. + +echo "http_proxy is $http_proxy" +echo "https_proxy is $https_proxy" + +# Keep the dependency list as short as reasonable +apt-get update +apt-get install --yes \ + bash \ + git \ + locales + +# Install AGL Demo Control Panel dependencies +apt-get install --yes \ + python3-pip \ + python3-pyqt5 \ + python3-qtpy \ + pyqt5-dev-tools + +# Set bash as default shell +echo "dash dash/sh boolean false" | debconf-set-selections - && dpkg-reconfigure dash + +# Set the locale +sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen + +apt-get --yes clean +apt-get --yes autoremove diff --git a/docker/set_up_agl-demo-control-panel.sh b/docker/set_up_agl-demo-control-panel.sh new file mode 100755 index 0000000..977c8ea --- /dev/null +++ b/docker/set_up_agl-demo-control-panel.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Disable the package proxy. +export http_proxy="" +export https_proxy="" + +# Clone AGL Demo Control Panel +cd /opt +http_proxy="" https_proxy="" git clone "https://gerrit.automotivelinux.org/gerrit/src/agl-demo-control-panel" +cd agl-demo-control-panel + +# We do not need to install all the requirements. +cp requirements.txt requirements_small.txt +sed -i 's/pyqt5/#pyqt5/g' requirements_small.txt +cat requirements_small.txt +pip3 install --break-system-packages -r requirements_small.txt +pyrcc5 assets/res.qrc -o res_rc.py
\ No newline at end of file |