annotate docker/sat_pubsub/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 d0a5db5b9bdf
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/sat_pubsub #
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 SàT Pubsub service 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
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 salutatoi/base:latest
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: 83
diff changeset
13 ############################
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
14 # AUTOMATIC CONFIGURATION #
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
15 ############################
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
16
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
17
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
18 COPY scripts/sat_pubsub /usr/local/bin/
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
19 RUN chown root:root /usr/local/bin/sat_pubsub && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
20 chmod 0555 /usr/local/bin/sat_pubsub && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
21
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
22 ########
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
23 # 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
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
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
26 apt-get install -y --no-install-recommends postgresql && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
27 apt-get install -y --no-install-recommends python-psycopg2 && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
28 apt-get clean && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
29 cd /usr/share && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
30 hg clone https://repos.goffi.org/sat_pubsub && chown -R sat:sat sat_pubsub && \
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
31
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
32 ############
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
33 # DATABASE #
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
34 ############
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
35
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
36 cd sat_pubsub/db && \
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
37
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
38 # To simplify installation, we integrate our own PostgreSQL
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
39 # future alternate version may use an external PostgreSQL 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
40
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
41 service postgresql start; \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
42 su -c "createuser -d -w sat" postgres; \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
43 su -c "createdb pubsub" postgres; \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
44 su -c "psql pubsub < pubsub.sql" sat; \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
45 service postgresql stop
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
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
47 ##########
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 # 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
49 ##########
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
50
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
51 # we need to launch PostgreSQL, so we launch as root then switch to sat user
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
52 ENTRYPOINT ["/bin/sh","-c", "service postgresql start && su -c sat_pubsub sat"]