comparison 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
comparison
equal deleted inserted replaced
3640:f4c02bdb2d91 3641:0ffaa231138c
1 FROM debian:buster-slim 1 FROM debian:bullseye-slim
2 2
3 LABEL maintainer="Goffi <tmp_dockerfiles@goffi.org>" 3 LABEL maintainer="Goffi <tmp_dockerfiles@goffi.org>"
4 4
5 ARG REVISION
5 ARG DEBIAN_FRONTEND=noninteractive 6 ARG DEBIAN_FRONTEND=noninteractive
6 7
7 RUN apt-get update && apt-get upgrade -y && \ 8 RUN echo "Building image for Libervia ${REVISION:-dev}" && \
9 apt-get update && apt-get upgrade -y && \
8 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 && \ 10 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 && \
9 \ 11 \
10 # will be used to put many SàT specific data 12 # will be used to put many Libervia specific data
11 mkdir -p /usr/share/libervia/certificates && \ 13 mkdir -p /usr/share/libervia/certificates && \
12 addgroup tls-cert --gid 9999 && \ 14 addgroup tls-cert --gid 9999 && \
13 chown :tls-cert /usr/share/libervia/certificates && \ 15 chown :tls-cert /usr/share/libervia/certificates && \
14 chmod 2770 /usr/share/libervia/certificates && \ 16 chmod 2770 /usr/share/libervia/certificates && \
15 # it's better to have a dedicated user 17 # it's better to have a dedicated user
16 useradd -m libervia && adduser libervia tls-cert && \ 18 useradd -m libervia && adduser libervia tls-cert && \
17 # we'll put all source there to have an easy mount point 19 # we'll put all source there to have an easy mount point
18 mkdir /src && chown libervia:libervia /src && \ 20 mkdir /src && chown libervia:libervia /src && \
19 \ 21 \
20 # we need UTF-8 locale 22 # we need UTF-8 locale
21 sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen && locale-gen && \ 23 sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen && locale-gen
22 \
23 # we need a TCP socket for D-Bus
24 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
25 24
26 ENV LC_ALL en_US.UTF-8 25 ENV LC_ALL en_US.UTF-8
26 ENV DOCKER_LIBERVIA_REV=${REVISION:-dev}
27
28 COPY --chown=root:root session.conf /usr/share/dbus-1/session.conf
27 29
28 WORKDIR /home/libervia 30 WORKDIR /home/libervia
29 USER libervia 31 USER libervia
30 32
31 RUN python3 -m venv libervia_env && libervia_env/bin/pip install -U pip wheel && cd /src && \ 33 RUN python3 -m venv libervia_env && libervia_env/bin/pip install -U pip wheel && cd /src && \
32 # We install thoses packages in editable mode, so we can replace them easily with volumes. 34 # We install thoses packages in editable mode, so we can replace them easily with volumes.
33 # We need to move *.egg-info (generated by pip) out of src dirs, otherwise mounting 35 # We need to move *.egg-info (generated by pip) out of src dirs, otherwise mounting
34 # local repos without it them cause troubles 36 # local repos without it them cause troubles
35 hg clone https://repos.goffi.org/urwid-satext && ~/libervia_env/bin/pip install -e urwid-satext && \ 37 hg clone https://repos.goffi.org/urwid-satext && ~/libervia_env/bin/pip install -e urwid-satext && \
36 mv urwid-satext/urwid_satext.egg-info ~/libervia_env/lib/python3.*/site-packages && \ 38 mv urwid-satext/urwid_satext.egg-info ~/libervia_env/lib/python3.*/site-packages && \
37 hg clone https://repos.goffi.org/sat_tmp && ~/libervia_env/bin/pip install -e sat_tmp && \ 39 hg clone https://repos.goffi.org/sat_tmp -u "${REVISION:-tip}" && ~/libervia_env/bin/pip install -e sat_tmp && \
38 mv sat_tmp/sat_tmp.egg-info ~/libervia_env/lib/python3.*/site-packages && \ 40 mv sat_tmp/sat_tmp.egg-info ~/libervia_env/lib/python3.*/site-packages && \
39 hg clone https://repos.goffi.org/sat_templates && ~/libervia_env/bin/pip install -e sat_templates && \ 41 hg clone https://repos.goffi.org/libervia-templates && ~/libervia_env/bin/pip install -e libervia-templates && \
40 mv sat_templates/libervia_templates.egg-info ~/libervia_env/lib/python3.*/site-packages && \ 42 mv libervia-templates/libervia_templates.egg-info ~/libervia_env/lib/python3.*/site-packages && \
41 hg clone https://repos.goffi.org/sat_media && \ 43 hg clone https://repos.goffi.org/libervia-media && \
42 hg clone https://repos.goffi.org/sat && ~/libervia_env/bin/pip install -e 'sat[SVG]' && \ 44 hg clone https://repos.goffi.org/libervia-backend -u "${REVISION:-tip}" && ~/libervia_env/bin/pip install -e 'libervia-backend[SVG]' && \
43 mv sat/libervia_backend.egg-info ~/libervia_env/lib/python3.*/site-packages 45 mv libervia-backend/libervia_backend.egg-info ~/libervia_env/lib/python3.*/site-packages && \
46 mkdir -p /home/libervia/.local/share/libervia
44 47
45 ENV DBUS_SESSION_BUS_ADDRESS=tcp:host=backend,port=55555,family=ipv4
46 ENV PATH=/home/libervia/libervia_env/bin:$PATH 48 ENV PATH=/home/libervia/libervia_env/bin:$PATH
47 49
48 COPY --chown=root:root libervia.conf /etc/_libervia.conf 50 COPY --chown=root:root libervia.conf /etc/_libervia.conf
49 COPY --chown=libervia:libervia scripts/entrypoint.sh /home/libervia/ 51 COPY --chown=libervia:libervia scripts/entrypoint.sh /home/libervia/
50 52