changeset 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 f4c02bdb2d91
children cc3b453670a2
files docker/backend-dev-e2e/Dockerfile docker/backend-dev/Dockerfile docker/backend-dev/session.conf docker/docker-compose-e2e.yml docker/docker-compose.yml docker/libervia-web-dev-demo/Dockerfile docker/libervia-web-dev-e2e/Dockerfile docker/libervia-web-dev/Dockerfile docker/pubsub/Dockerfile
diffstat 9 files changed, 83 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/docker/backend-dev-e2e/Dockerfile	Wed Sep 08 11:13:35 2021 +0200
+++ b/docker/backend-dev-e2e/Dockerfile	Wed Sep 08 11:14:17 2021 +0200
@@ -1,4 +1,5 @@
-FROM libervia/backend:dev
+ARG REVISION=dev
+FROM libervia/backend:${REVISION}
 
 LABEL maintainer="Goffi <tmp_dockerfiles@goffi.org>"
 
@@ -46,7 +47,7 @@
 RUN \
     # pytest and its plugins
     pip install pytest pytest-timeout pytest-dependency \
-    # needed to test jp
+    # needed to test libervia-cli
     sh \
     # needed to test libervia
     helium \
@@ -57,7 +58,7 @@
 
 RUN ./entrypoint.sh \
     # we create the file sharing component which will autoconnect when backend is started
-    jp profile create file_sharing -j files.server1.test -p "" --xmpp-password test_e2e -C file_sharing -A && \
+    li profile create file_sharing -j files.server1.test -p "" --xmpp-password test_e2e -C file_sharing -A && \
     libervia-backend stop
 
 ENV LIBERVIA_TEST_REPORT_DIR=/reports
--- 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/backend-dev/session.conf	Wed Sep 08 11:14:17 2021 +0200
@@ -0,0 +1,32 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+	<type>session</type>
+	<keep_umask/>
+	<listen>unix:path=/home/libervia/.local/share/libervia/dbus_socket</listen>
+	<listen>tcp:host=localhost,bind=*,port=55555,family=ipv4</listen>
+	<auth>ANONYMOUS</auth>
+	<allow_anonymous/>
+	<standard_session_servicedirs />
+	<policy context="default">
+		<allow send_destination="*" eavesdrop="true"/>
+		<allow eavesdrop="true"/>
+		<allow own="*"/>
+	</policy>
+	<include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
+	<limit name="max_incoming_bytes">1000000000</limit>
+	<limit name="max_incoming_unix_fds">250000000</limit>
+	<limit name="max_outgoing_bytes">1000000000</limit>
+	<limit name="max_outgoing_unix_fds">250000000</limit>
+	<limit name="max_message_size">1000000000</limit>
+	<limit name="service_start_timeout">120000</limit>
+	<limit name="auth_timeout">240000</limit>
+	<limit name="pending_fd_timeout">150000</limit>
+	<limit name="max_completed_connections">100000</limit>
+	<limit name="max_incomplete_connections">10000</limit>
+	<limit name="max_connections_per_user">100000</limit>
+	<limit name="max_pending_service_starts">10000</limit>
+	<limit name="max_names_per_connection">50000</limit>
+	<limit name="max_match_rules_per_connection">50000</limit>
+	<limit name="max_replies_per_connection">50000</limit>
+</busconfig>
--- a/docker/docker-compose-e2e.yml	Wed Sep 08 11:13:35 2021 +0200
+++ b/docker/docker-compose-e2e.yml	Wed Sep 08 11:14:17 2021 +0200
@@ -38,8 +38,11 @@
       LIBERVIA_PUBSUB_XMPP_PWD: test_e2e
 
   backend:
-    image: libervia/backend:dev-e2e
-    build: backend-dev-e2e
+    image: libervia/backend:${DOCKER_LIBERVIA_REV:-dev}-e2e
+    build:
+      context: backend-dev-e2e
+      args:
+        REVISION: ${DOCKER_LIBERVIA_REV:-}
     environment:
       LIBERVIA_TEST_ENV_E2E: "1"
       LIBERVIA_TEST_ENV_E2E_WEB: "1"
@@ -54,8 +57,11 @@
           - libervia-backend.test
 
   web:
-    image: libervia/web:dev-e2e
-    build: libervia-web-dev-e2e
+    image: libervia/web:${DOCKER_LIBERVIA_REV:-dev}-e2e
+    build:
+      context: libervia-web-dev-e2e
+      args:
+        REVISION: ${DOCKER_LIBERVIA_REV:-}
     depends_on:
       - backend
     environment:
--- a/docker/docker-compose.yml	Wed Sep 08 11:13:35 2021 +0200
+++ b/docker/docker-compose.yml	Wed Sep 08 11:14:17 2021 +0200
@@ -2,11 +2,17 @@
 services:
 
   backend:
-    image: libervia/backend:dev
-    build: backend-dev
+    image: "libervia/backend:${DOCKER_LIBERVIA_REV:-dev}"
+    build:
+      context: backend-dev
+      args:
+        REVISION: "${DOCKER_LIBERVIA_REV:-}"
 
   web:
-    image: libervia/web:dev
-    build: libervia-web-dev
+    image: "libervia/web:${DOCKER_LIBERVIA_REV:-dev}"
+    build:
+      context: libervia-web-dev
+      args:
+        REVISION: "${DOCKER_LIBERVIA_REV:-}"
     depends_on:
       - backend
--- a/docker/libervia-web-dev-demo/Dockerfile	Wed Sep 08 11:13:35 2021 +0200
+++ b/docker/libervia-web-dev-demo/Dockerfile	Wed Sep 08 11:14:17 2021 +0200
@@ -1,4 +1,5 @@
-FROM libervia/web:dev
+ARG REVISION=dev
+FROM libervia/web:${REVISION}
 
 LABEL maintainer="Goffi <tmp_dockerfiles@goffi.org>"
 
--- a/docker/libervia-web-dev-e2e/Dockerfile	Wed Sep 08 11:13:35 2021 +0200
+++ b/docker/libervia-web-dev-e2e/Dockerfile	Wed Sep 08 11:14:17 2021 +0200
@@ -1,4 +1,5 @@
-FROM libervia/web:dev
+ARG REVISION=dev
+FROM libervia/web:${REVISION}
 
 LABEL maintainer="Goffi <tmp_dockerfiles@goffi.org>"
 
--- a/docker/libervia-web-dev/Dockerfile	Wed Sep 08 11:13:35 2021 +0200
+++ b/docker/libervia-web-dev/Dockerfile	Wed Sep 08 11:14:17 2021 +0200
@@ -1,7 +1,9 @@
-FROM libervia/backend:dev
+ARG REVISION
+FROM libervia/backend:${REVISION:-dev}
 
 LABEL maintainer="Goffi <tmp_dockerfiles@goffi.org>"
 
+ARG REVISION
 ARG DEBIAN_FRONTEND=noninteractive
 
 USER root
@@ -9,9 +11,9 @@
 RUN apt-get install -y --no-install-recommends yarnpkg
 WORKDIR /home/libervia
 USER libervia
-RUN cd /src && hg clone https://repos.goffi.org/libervia && \
-    ~/libervia_env/bin/pip install -e libervia && \
-    mv libervia/libervia_web.egg-info ~/libervia_env/lib/python3.*/site-packages
+RUN cd /src && hg clone https://repos.goffi.org/libervia-web -u "${REVISION:-tip}" && \
+    ~/libervia_env/bin/pip install -e libervia-web && \
+    mv libervia-web/libervia_web.egg-info ~/libervia_env/lib/python3.*/site-packages
 
 RUN ./entrypoint.sh \
     # we build here to avoid re-downloading node modules or other browser
--- a/docker/pubsub/Dockerfile	Wed Sep 08 11:13:35 2021 +0200
+++ b/docker/pubsub/Dockerfile	Wed Sep 08 11:14:17 2021 +0200
@@ -1,4 +1,4 @@
-FROM debian:buster-slim
+FROM debian:bullseye-slim
 
 LABEL maintainer="Goffi <tmp_dockerfiles@goffi.org>"