From 3c61e44cf683a5514966eb46db96e1b15c0879c5 Mon Sep 17 00:00:00 2001
From: Tom Downes <tpdownes@gmail.com>
Date: Mon, 11 Feb 2019 16:28:47 -0600
Subject: [PATCH] Add supervisor configuration to launch shibboleth SP daemon
 only when ENABLE_SHIBD environment variable is set to "true"
 (default="false")

---
 Dockerfile                    | 2 ++
 docker/supervisord-shibd.conf | 1 +
 2 files changed, 3 insertions(+)

diff --git a/Dockerfile b/Dockerfile
index 3068d0135..ea8819ec3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -35,6 +35,7 @@ RUN apt-get install --install-recommends --assume-yes \
 
 COPY docker/supervisord.conf /etc/supervisor/supervisord.conf
 COPY docker/supervisord-apache2.conf /etc/supervisor/conf.d/apache2.conf
+COPY docker/supervisord-shibd.conf /etc/supervisor/conf.d/shibd.conf
 COPY docker/shibboleth-ds /etc/shibboleth-ds
 COPY docker/apache-config /etc/apache2/sites-available/gracedb.conf
 COPY docker/login.ligo.org.cert.LIGOCA.pem /etc/shibboleth/login.ligo.org.cert.LIGOCA.pem
@@ -56,6 +57,7 @@ RUN pip install --upgrade setuptools wheel && \
 
 # Give pip-installed packages priority over distribution packages
 ENV PYTHONPATH /usr/local/lib/python2.7/dist-packages:$PYTHONPATH
+ENV ENABLE_SHIBD false
 ENV VIRTUAL_ENV dummy
 
 # Expose port and run Gunicorn
diff --git a/docker/supervisord-shibd.conf b/docker/supervisord-shibd.conf
index e950085b3..c58279bd9 100644
--- a/docker/supervisord-shibd.conf
+++ b/docker/supervisord-shibd.conf
@@ -1,4 +1,5 @@
 [program:shibd]
+autostart=%(ENV_ENABLE_SHIBD)s
 command=/usr/sbin/shibd -F
 user=_shibd
 group=_shibd
-- 
GitLab