Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions st2web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ LABEL com.stackstorm.component="st2web"

ENV container docker
ENV TERM xterm
ENV ST2WEB_HTTPS 0

# Default, but overrideable env vars to be substituted in st2.template nginx conf
ENV ST2_AUTH_URL http://st2auth:9100/
Expand Down Expand Up @@ -53,23 +54,28 @@ RUN if [ "${ST2_VERSION#*dev}" != "${ST2_VERSION}" ]; then \
&& rm -f /etc/apt/sources.list.d/StackStorm_*.list

# Download st2.conf and apply patch
COPY files/st2.conf.patch /tmp
COPY files/st2.conf-http.patch /tmp
COPY files/st2.conf-https.patch /tmp
RUN if [ "${ST2_VERSION#*dev}" != "${ST2_VERSION}" ]; then \
ST2_BRANCH=master; \
else \
ST2_BRANCH=v${ST2_VERSION%.*}; \
fi \
&& echo ST2_BRANCH=${ST2_BRANCH} \
&& apt-get install -y patch gettext-base \
&& curl -sf https://raw.githubusercontent.com/StackStorm/st2/${ST2_BRANCH}/conf/nginx/st2.conf -o /etc/nginx/conf.d/st2.template \
&& patch /etc/nginx/conf.d/st2.template < /tmp/st2.conf.patch \
&& curl -sf https://raw.githubusercontent.com/StackStorm/st2/${ST2_BRANCH}/conf/nginx/st2.conf -o /etc/nginx/conf.d/st2-http.template \
&& cp /etc/nginx/conf.d/st2-http.template /etc/nginx/conf.d/st2-https.template \
&& patch /etc/nginx/conf.d/st2-http.template < /tmp/st2.conf-http.patch \
&& patch /etc/nginx/conf.d/st2-https.template < /tmp/st2.conf-https.patch \
&& rm -f /etc/nginx/conf.d/default.conf \
&& rm -f /tmp/st2.conf.patch
&& rm -f /tmp/st2.conf.patch \
&& rm -f /tmp/st2.conf-http.patch \
&& rm -f /tmp/st2.conf-https.patch

# It's a user's responsbility to pass the valid SSL certificate files: 'st2.key' and 'st2.crt', used in nginx
VOLUME ["/etc/ssl/st2/"]

EXPOSE 80
EXPOSE 443
STOPSIGNAL SIGTERM
CMD ["/bin/bash", "-c", "envsubst '${ST2_AUTH_URL} ${ST2_API_URL} ${ST2_STREAM_URL}' < /etc/nginx/conf.d/st2.template > /etc/nginx/conf.d/st2.conf && exec nginx -g 'daemon off;'"]
CMD ["/bin/bash", "-c", "if [ \"${ST2WEB_HTTPS:-0}\" = \"1\" ]; then ST2WEB_TEMPLATE = \"/etc/nginx/conf.d/st2-https.template\"; else ST2WEB_TEMPLATE = \"/etc/nginx/conf.d/st2-http.template\"; fi && envsubst '${ST2_AUTH_URL} ${ST2_API_URL} ${ST2_STREAM_URL}' < ${ST2WEB_TEMPLATE} > /etc/nginx/conf.d/st2.conf && exec nginx -g 'daemon off;'"]