Mercurial > sat_docs
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 |
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 | 13 ############################ |
14 # AUTOMATIC CONFIGURATION # | |
15 ############################ | |
16 | |
17 | |
116 | 18 COPY scripts/sat_pubsub scripts/launch_postgres_and_pubsub.sh /usr/local/bin/ |
105 | 19 RUN chown root:root /usr/local/bin/sat_pubsub && \ |
20 chmod 0555 /usr/local/bin/sat_pubsub && \ | |
116 | 21 chmod 0555 /usr/local/bin/launch_postgres_and_pubsub.sh && \ |
105 | 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 | 27 apt-get install -y --no-install-recommends postgresql && \ |
28 apt-get install -y --no-install-recommends python-psycopg2 && \ | |
29 apt-get clean && \ | |
30 cd /usr/share && \ | |
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 | 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 | 42 service postgresql start; \ |
43 su -c "createuser -d -w sat" postgres; \ | |
44 su -c "createdb pubsub" postgres; \ | |
45 su -c "psql pubsub < pubsub.sql" sat; \ | |
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 | 53 ENTRYPOINT ["launch_postgres_and_pubsub.sh"] |