diff docker/backend-dev/Dockerfile @ 3641:0ffaa231138c

docker: Libervia revision can now be specified: Using the `DOCKER_LIBERVIA_REV` environment variable, backend (and related repos) revision can now be specified. By default (variable empty or not set), the current `tip` version is used, and `dev` is used for tagging. If the variable is set, the revision will be used and used for tagging the image.
author Goffi <goffi@goffi.org>
date Wed, 08 Sep 2021 11:14:17 +0200
parents 443b3a784eba
children 57d43e3e0095
line wrap: on
line diff
--- a/docker/backend-dev/Dockerfile	Wed Sep 08 11:13:35 2021 +0200
+++ b/docker/backend-dev/Dockerfile	Wed Sep 08 11:14:17 2021 +0200
@@ -1,13 +1,15 @@
-FROM debian:buster-slim
+FROM debian:bullseye-slim
 
 LABEL maintainer="Goffi <tmp_dockerfiles@goffi.org>"
 
+ARG REVISION
 ARG DEBIAN_FRONTEND=noninteractive
 
-RUN apt-get update && apt-get upgrade -y && \
+RUN echo "Building image for Libervia ${REVISION:-dev}" && \
+    apt-get update && apt-get upgrade -y && \
     apt-get install -y --no-install-recommends locales python3-dev python3-venv python3-wheel mercurial libxml2-dev libxslt-dev libcairo2-dev libjpeg-dev libgirepository1.0-dev libdbus-1-dev libdbus-glib-1-dev dbus-x11 cmake && \
     \
-    # will be used to put many SàT specific data
+    # will be used to put many Libervia specific data
     mkdir -p /usr/share/libervia/certificates && \
     addgroup tls-cert --gid 9999 && \
     chown :tls-cert /usr/share/libervia/certificates && \
@@ -18,12 +20,12 @@
     mkdir /src && chown libervia:libervia /src && \
     \
     # we need UTF-8 locale
-    sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen && locale-gen && \
-    \
-    # we need a TCP socket for D-Bus
-    sed -i "s&<listen>unix:tmpdir=/tmp</listen>&\0\n  <listen>tcp:host=localhost,bind=*,port=55555,family=ipv4</listen>\n  <auth>ANONYMOUS</auth>\n  <allow_anonymous/>&" /usr/share/dbus-1/session.conf
+    sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen && locale-gen
 
 ENV LC_ALL en_US.UTF-8
+ENV DOCKER_LIBERVIA_REV=${REVISION:-dev}
+
+COPY --chown=root:root session.conf /usr/share/dbus-1/session.conf
 
 WORKDIR /home/libervia
 USER libervia
@@ -34,15 +36,15 @@
     # local repos without it them cause troubles
     hg clone https://repos.goffi.org/urwid-satext && ~/libervia_env/bin/pip install -e urwid-satext && \
     mv urwid-satext/urwid_satext.egg-info ~/libervia_env/lib/python3.*/site-packages && \
-    hg clone https://repos.goffi.org/sat_tmp && ~/libervia_env/bin/pip install -e sat_tmp && \
+    hg clone https://repos.goffi.org/sat_tmp -u "${REVISION:-tip}" && ~/libervia_env/bin/pip install -e sat_tmp && \
     mv sat_tmp/sat_tmp.egg-info ~/libervia_env/lib/python3.*/site-packages && \
-    hg clone https://repos.goffi.org/sat_templates && ~/libervia_env/bin/pip install -e sat_templates && \
-    mv sat_templates/libervia_templates.egg-info ~/libervia_env/lib/python3.*/site-packages && \
-    hg clone https://repos.goffi.org/sat_media && \
-    hg clone https://repos.goffi.org/sat && ~/libervia_env/bin/pip install -e 'sat[SVG]' && \
-    mv sat/libervia_backend.egg-info ~/libervia_env/lib/python3.*/site-packages
+    hg clone https://repos.goffi.org/libervia-templates && ~/libervia_env/bin/pip install -e libervia-templates && \
+    mv libervia-templates/libervia_templates.egg-info ~/libervia_env/lib/python3.*/site-packages && \
+    hg clone https://repos.goffi.org/libervia-media && \
+    hg clone https://repos.goffi.org/libervia-backend -u "${REVISION:-tip}" && ~/libervia_env/bin/pip install -e 'libervia-backend[SVG]' && \
+    mv libervia-backend/libervia_backend.egg-info ~/libervia_env/lib/python3.*/site-packages && \
+    mkdir -p /home/libervia/.local/share/libervia
 
-ENV DBUS_SESSION_BUS_ADDRESS=tcp:host=backend,port=55555,family=ipv4
 ENV PATH=/home/libervia/libervia_env/bin:$PATH
 
 COPY --chown=root:root libervia.conf /etc/_libervia.conf