annotate docker/base/Dockerfile @ 105:b69056368901

docker: images optimisation: - reduced the number of layers by grouping many instructions - moved stuff which don't change a lot at the beginning, and hg/apt at the end - scripts are not now in scripts/ subdirectories - prosody.cfg.lua is added using ADD instead of getting it online - .hg/dirstate is copied in base (backend) and libervia, so mercurial revision is known - removed lot of useless WORKDIR instruction, they are replaced by "cd" inside RUN instructions - cleaning (apt-clean, rm) is done on the same instruction as the one than generate the data, to avoid useless data in layers
author Goffi <goffi@goffi.org>
date Sun, 28 Feb 2016 02:01:20 +0100
parents 6e6274aa3916
children 8b228fd053bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
1 ###############################################################
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
3 # Salut à Toi/base #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # This Dockerfile build a « Salut à Toi » base image #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # Salut à Toi is a multi-frontends multi-purposes XMPP client #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
7 ###############################################################
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
8
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
9 FROM debian:jessie
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
10
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
11 MAINTAINER Goffi <goffi@goffi.org>
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
12
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
13 ########
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # BASE #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
15 ########
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
16
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
17 ENV DEBIAN_FRONTEND noninteractive
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
18
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
19 ## Helping scripts ##
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
20 # Following scripts make the configuration as automatic and easy as possible
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
21 COPY scripts/set_account_domain scripts/sat scripts/add_host scripts/dbus_wrap scripts/prosodyctl /usr/local/bin/
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
22
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
23 RUN chown root:root /usr/local/bin/set_account_domain && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
24 chmod 0555 /usr/local/bin/set_account_domain && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
25 chown root:root /usr/local/bin/sat && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
26 chmod 0500 /usr/local/bin/sat && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
27 chown root:root /usr/local/bin/add_host && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
28 chmod 0555 /usr/local/bin/add_host && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
29 chown root:root /usr/local/bin/prosodyctl && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
30 chmod 0555 /usr/local/bin/prosodyctl && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
31 chown root:root /usr/local/bin/dbus_wrap && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
32 chmod 0555 /usr/local/bin/dbus_wrap && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
33
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
34 # it's better to have a dedicated user
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
35 useradd -m sat && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
36
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
37 # will be used to put many SàT specific data
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
38 mkdir -p /usr/share/sat && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
39 mkdir /usr/share/sat/certificates && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
40 addgroup tls-cert --gid 9999 && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
41 chown :tls-cert /usr/share/sat/certificates && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
42 chmod 2770 /usr/share/sat/certificates && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
43 adduser sat tls-cert
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
44
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
45 RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends locales dbus-x11 python python-gobject-2 python-dbus python-lxml python-mutagen python-pil python-crypto python-feed python-potr python-twisted-core python-twisted-mail python-twisted-web python-twisted-words python-wokkel python-xdg python-xe python-zope.interface python-gi python-urwid python-markdown python-html2text mercurial python-pip && apt-get clean && \
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
46
94
eeff161a19e8 docker (base): add dokuwiki module for dokuwiki importer + fixed /etc/hosts for subdomains
Goffi <goffi@goffi.org>
parents: 84
diff changeset
47 # dokuwiki module is needed for the blog importer
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
48
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
49 pip install dokuwiki && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
50
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
51 # we need a TCP socket for D-Bus
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
52 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/>&" /etc/dbus-1/session.conf && \
94
eeff161a19e8 docker (base): add dokuwiki module for dokuwiki importer + fixed /etc/hosts for subdomains
Goffi <goffi@goffi.org>
parents: 84
diff changeset
53
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
54 # we need UTF-8 locale
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
55 sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen && locale-gen
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
56
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
57 ENV LC_ALL en_US.UTF-8
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
58
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
59 ################
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
60 # URWID SÀTEXT #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
61 ################
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
62
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
63 RUN cd /tmp && \
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
64
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
65 hg clone https://repos.goffi.org/urwid-satext && cd urwid-satext && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
66 python setup.py install --prefix /usr --install-lib /usr/lib/python2.7/dist-packages && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
67 rm -rf urwid-satext && \
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
68
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
69 #####################
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
70 # CORE INSTALLATION #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
71 #####################
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
72
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
73 hg clone https://repos.goffi.org/sat && cd sat && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
74 python setup.py install --prefix /usr --install-lib /usr/lib/python2.7/dist-packages && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
75 # we copy .hg/dirstate so SàT can get repository version
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
76 # TODO: should be done in setup.py in the future
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
77 cp --parents .hg/dirstate /usr/lib/python2.7/dist-packages/sat && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
78 cd /tmp && rm -rf sat && \
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
79
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
80 ######################
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
81 # SàT CONFIGURATION #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
82 ######################
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
83
83
8dd32aa49614 docker: pid files are put in /tmp to avoid conflict when restarting a container
Goffi <goffi@goffi.org>
parents: 80
diff changeset
84 # we want .pid files in /tmp so they are removed if container are deleted
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
85 echo '[DEFAULT]\npid_dir=/tmp\n\n\
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
86 # we auto-create libervia account if it doesn't exists in Libervia container
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
87 # so we remove it from reserved_list in plugin account
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 97
diff changeset
88 [plugin account]\nreserved_list=' >> /etc/sat.conf
21
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
89
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
90 ##########
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
91 # LAUNCH #
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
92 ##########
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
93
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
94 WORKDIR /home/sat
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
95
0e78c8a4626e Added Dockerfiles to create Docker images for easy installation + scripts to manages them. see README for details.
Goffi <goffi@goffi.org>
parents:
diff changeset
96 ENTRYPOINT ["/bin/bash"]