annotate docker/prosody/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 30f3f83d6959
children 470dafe3f5b6
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/Prosody #
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 Prosody version prepared for SàT #
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
85
bcba1966e6db docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents: 80
diff changeset
9 FROM salutatoi/sat_pubsub:latest
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
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
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
13 ############################
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
14 # AUTOMATIC CONFIGURATION #
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
15 ############################
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
16
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
17
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
18 COPY scripts/container_server scripts/prosody /usr/local/bin/
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
19 RUN chown root:root /usr/local/bin/container_server && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
20 chmod 0555 /usr/local/bin/container_server && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
21 chown root:root /usr/local/bin/prosody && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
22 chmod 0555 /usr/local/bin/prosody
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
23
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
24 ########
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
25 # 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
26 ########
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
27
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
28 RUN apt-get install -y --no-install-recommends lsb-release && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
29
80
686a8c982c3f docker: updated Dockerfiles:
Goffi <goffi@goffi.org>
parents: 21
diff changeset
30 # we add prosody repository and key
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
31 echo deb http://packages.prosody.im/debian $(lsb_release -sc) main > /etc/apt/sources.list.d/prosody.list && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
32 python -c 'import urllib2;import subprocess as s;s.Popen(["apt-key","add","-"], stdin=s.PIPE).communicate(urllib2.urlopen("https://prosody.im/files/prosody-debian-packages.key").read())' && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
33 apt-get update && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
34
80
686a8c982c3f docker: updated Dockerfiles:
Goffi <goffi@goffi.org>
parents: 21
diff changeset
35 # and install prosody and apg (to generate passwords)
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
36 apt-get install -y apg prosody-0.10 && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
37 apt-get clean && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
38
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
39 # prosody user need to access (and write) certificates
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
40 adduser prosody tls-cert && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
41
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
42 # prosody need to access /var/run to write it's pid
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
43 mkdir -p /var/run/prosody; chown prosody:adm /var/run/prosody
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
44
80
686a8c982c3f docker: updated Dockerfiles:
Goffi <goffi@goffi.org>
parents: 21
diff changeset
45 ###################
686a8c982c3f docker: updated Dockerfiles:
Goffi <goffi@goffi.org>
parents: 21
diff changeset
46 # PROSODY MODULES #
686a8c982c3f docker: updated Dockerfiles:
Goffi <goffi@goffi.org>
parents: 21
diff changeset
47 ###################
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
48
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
49 RUN cd /tmp && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
50 hg clone https://hg.prosody.im/prosody-modules/ prosody-modules && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
51 cd prosody-modules && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
52 for mod in privilege delegation ipcheck http_upload;do cp mod_$mod/mod_$mod.lua /usr/lib/prosody/modules;done && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
53 cd /tmp && rm -rf prosody-modules
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
80
686a8c982c3f docker: updated Dockerfiles:
Goffi <goffi@goffi.org>
parents: 21
diff changeset
55 #################
686a8c982c3f docker: updated Dockerfiles:
Goffi <goffi@goffi.org>
parents: 21
diff changeset
56 # CONFIGURATION #
686a8c982c3f docker: updated Dockerfiles:
Goffi <goffi@goffi.org>
parents: 21
diff changeset
57 #################
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
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
59 ADD prosody.cfg.lua /etc/prosody/prosody_sat_cfg/
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
60 RUN cd /etc/prosody && chown -R prosody:prosody prosody_sat_cfg && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
61 ln -fs prosody_sat_cfg/prosody.cfg.lua prosody.cfg.lua && \
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
62
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
63 ###############
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 # CERTIFICATE #
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
65 ###############
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
66
85
bcba1966e6db docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents: 80
diff changeset
67 # We want to use the certificates in /usr/share/sat/certificates
bcba1966e6db docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents: 80
diff changeset
68 # and we don't want any certificate in the image,
bcba1966e6db docker: certificate generation + various improvments:
Goffi <goffi@goffi.org>
parents: 80
diff changeset
69 # they'll be generated at launch or mounted in container
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
70 rm -rf /etc/localhost.key /etc/prosody/certs/*
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
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 #########
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
73 # PORTS #
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
74 #########
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
75
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
76 # client to server (C2S),
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
77 # server to server (S2S),
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
78 # HTTP upload,
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
79 # and HTTP upload (HTTPS)
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 91
diff changeset
80 EXPOSE 5222 5269 5280 5281
91
30f3f83d6959 docker (prosody, libervia_cont): expose HTTP upload ports in Prosody image
Goffi <goffi@goffi.org>
parents: 85
diff changeset
81
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
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 # 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
84 ##########
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
85
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 USER prosody
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
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
88 ENTRYPOINT ["prosody"]