comparison docker/salut/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 8dd32aa49614
children
comparison
equal deleted inserted replaced
104:b59491821a8a 105:b69056368901
8 8
9 FROM salutatoi/base:latest 9 FROM salutatoi/base:latest
10 10
11 MAINTAINER Goffi <goffi@goffi.org> 11 MAINTAINER Goffi <goffi@goffi.org>
12 12
13 ############################
14 # AUTOMATIC CONFIGURATION #
15 ############################
16
17 COPY scripts/salut /usr/local/bin/
18 RUN chown root:root /usr/local/bin/salut && \
19 chmod 0555 /usr/local/bin/salut && \
20
13 ######## 21 ########
14 # BASE # 22 # BASE #
15 ######## 23 ########
16 24
17 RUN apt-get clean 25 cd /usr/share && hg clone https://repos.goffi.org/salut sat_salut && chown -R sat:sat sat_salut && \
18 26
19 # This script launch Salut with domain and secret gotten from prosody container 27 # configuration is really basic in salut, we just use environment to set data
20 # it make the configuration more easy 28 sed -i 's/^xmppcomponent =.*$/import os\nxmppcomponent = Component("prosody", 5347, "salut."+os.getenv("DOMAIN"), os.getenv("SAT_SALUT_SECRET"))/' sat_salut/salut.tac
21 RUN echo '#!/usr/bin/env python2\n\
22 import os, xmlrpclib\n\
23 SALUT_PATH="/usr/share/sat_salut/"\n\
24 os.chdir("/home/sat")\n\
25 proxy = xmlrpclib.ServerProxy("http://prosody:9999/")\n\
26 for var in ("DOMAIN", "SAT_SALUT_SECRET"):\n\
27 os.environ[var] = proxy.getenv(var)\n\
28 os.environ["PYTHONPATH"] = SALUT_PATH\n\
29 os.execlp("twistd", "twistd", "-ny", SALUT_PATH+"salut.tac", "--pidfile", "/tmp/salut.pid")\n\
30 ' > /usr/local/bin/salut && chmod 0555 /usr/local/bin/salut
31 29
32 WORKDIR /usr/share 30 WORKDIR /usr/share/sat_salut
33
34 RUN hg clone https://repos.goffi.org/salut sat_salut && chown -R sat:sat sat_salut
35
36 WORKDIR sat_salut
37 31
38 USER sat 32 USER sat
39
40 # configuration is really basic in salut, we just use environment to set data
41 RUN sed -i 's/^xmppcomponent =.*$/import os\nxmppcomponent = Component("prosody", 5347, "salut."+os.getenv("DOMAIN"), os.getenv("SAT_SALUT_SECRET"))/' salut.tac
42 33
43 ########## 34 ##########
44 # LAUNCH # 35 # LAUNCH #
45 ########## 36 ##########
46 37