annotate docker/sat_pubsub/Dockerfile @ 116:d0a5db5b9bdf

docker: fixed bad stopping: - use exec when it was missing, so the TERM signal is properly catched, and containers can be stopped instead of being killed after 10s - for a unknown reason, exec and su don't handle correctly "$@" with Docker in base.scripts/sat. It's working as expected when launched from withing a running container, but not when launched with "docker run", so a workaround is used with trap and wait
author Goffi <goffi@goffi.org>
date Fri, 04 Mar 2016 23:31:26 +0100
parents b69056368901
children d493fe1cf095
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
116
d0a5db5b9bdf docker: fixed bad stopping:
Goffi <goffi@goffi.org>
parents: 105
diff changeset
18 COPY scripts/sat_pubsub scripts/launch_postgres_and_pubsub.sh /usr/local/bin/
105
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 && \
116
d0a5db5b9bdf docker: fixed bad stopping:
Goffi <goffi@goffi.org>
parents: 105
diff changeset
21 chmod 0555 /usr/local/bin/launch_postgres_and_pubsub.sh && \
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
22
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
23 ########
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 # 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
25 ########
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
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
27 apt-get install -y --no-install-recommends postgresql && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
28 apt-get install -y --no-install-recommends python-psycopg2 && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
29 apt-get clean && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
30 cd /usr/share && \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
31 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
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 ############
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 # 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
35 ############
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
36
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
37 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
38
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 # 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
40 # 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
41
105
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
42 service postgresql start; \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
43 su -c "createuser -d -w sat" postgres; \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
44 su -c "createdb pubsub" postgres; \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
45 su -c "psql pubsub < pubsub.sql" sat; \
b69056368901 docker: images optimisation:
Goffi <goffi@goffi.org>
parents: 83
diff changeset
46 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
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 ##########
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 # 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
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
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 # we need to launch PostgreSQL, so we launch as root then switch to sat user
116
d0a5db5b9bdf docker: fixed bad stopping:
Goffi <goffi@goffi.org>
parents: 105
diff changeset
53 ENTRYPOINT ["launch_postgres_and_pubsub.sh"]