mirror of
https://github.com/rlister/dockerfiles.git
synced 2025-12-12 17:26:15 +00:00
add nginx-confd
This commit is contained in:
25
nginx-confd/Dockerfile
Normal file
25
nginx-confd/Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
||||
FROM debian:jessie
|
||||
|
||||
MAINTAINER Ric Lister <rlister@gmail.com>
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install -yq \
|
||||
curl \
|
||||
nginx && \
|
||||
rm /etc/nginx/sites-enabled/default
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
## install confd
|
||||
ENV CONFD_RELEASE 0.7.1
|
||||
RUN curl -Ls https://github.com/kelseyhightower/confd/releases/download/v${CONFD_RELEASE}/confd-${CONFD_RELEASE}-linux-amd64 -o confd && \
|
||||
chmod 0755 confd
|
||||
|
||||
## confd setup and runner
|
||||
ADD app.sh /app/
|
||||
RUN chmod 0755 app.sh
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
CMD [ "/app/app.sh" ]
|
||||
20
nginx-confd/app.sh
Executable file
20
nginx-confd/app.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
## make sure this script bails on any failures
|
||||
set -eo pipefail
|
||||
|
||||
## how to get to etcd from inside container
|
||||
export ETCD=${ETCD:-http://172.17.42.1:4001}
|
||||
|
||||
## wait until we can make initial nginx config
|
||||
until ./confd -verbose -onetime -node $ETCD -confdir /app ; do
|
||||
echo "confd waiting to create initial nginx config"
|
||||
sleep 5
|
||||
done
|
||||
|
||||
## run confd to poll etcd for changes
|
||||
echo "confd polling etcd ..."
|
||||
./confd -verbose -interval 10 -node $ETCD -confdir /app &
|
||||
|
||||
## run nginx in foreground
|
||||
nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user