Merge branch 'master' of https://github.com/JrCs/docker-nginx-proxy-letsencrypt into JrCs-master
This commit is contained in:
commit
f913b7138d
5 changed files with 42 additions and 33 deletions
31
Dockerfile
31
Dockerfile
|
@ -1,31 +1,10 @@
|
|||
FROM jwilder/nginx-proxy
|
||||
MAINTAINER [ "David Parrish <daveparrish@tutanota.com", "Yves Blusseau <90z7oey02@sneakemail.com>", "Hadrien Mary <hadrien.mary@gmail.com>" ]
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
# Install python packages needed by simp_le
|
||||
RUN apt-get install -y -q --no-install-recommends python python-requests
|
||||
|
||||
# Install python packages needed to build simp_le
|
||||
RUN apt-get install -y -q --no-install-recommends git gcc libssl-dev libffi-dev python-dev python-pip
|
||||
|
||||
# Get Let's Encrypt simp_le client source
|
||||
RUN git -C /opt clone https://github.com/kuba/simp_le.git
|
||||
|
||||
WORKDIR /opt/simp_le
|
||||
# Upgrade setuptools
|
||||
RUN pip install -U setuptools
|
||||
# Install simp_le in /usr/local/bin
|
||||
RUN python ./setup.py install
|
||||
|
||||
# Make house cleaning
|
||||
RUN rm -rf /opt/simp_le
|
||||
|
||||
RUN apt-get autoremove -y git gcc libssl-dev libffi-dev python-dev python-pip
|
||||
|
||||
RUN apt-get clean all
|
||||
RUN rm -r /var/lib/apt/lists/*
|
||||
MAINTAINER David Parrish <daveparrish@tutanota.com>
|
||||
MAINTAINER Yves Blusseau <90z7oey02@sneakemail.com>
|
||||
MAINTAINER Hadrien Mary <hadrien.mary@gmail.com>
|
||||
|
||||
COPY . /app/
|
||||
|
||||
WORKDIR /app/
|
||||
# Install simp_le program
|
||||
RUN chmod +rx /app/install_simp_le.sh && /app/install_simp_le.sh && rm -f /app/install_simp_le.sh
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
  [](https://circleci.com/gh/dmp1ce/nginx-proxy-letsencrypt)
|
||||
  [](https://circleci.com/gh/dmp1ce/nginx-proxy-letsencrypt) [](https://imagelayers.io/?images=dmp1ce/nginx-proxy-letsencrypt:latest 'Get your own badge on imagelayers.io')
|
||||
|
||||
nginx-proxy sets up a container running nginx and [docker-gen][1]. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.
|
||||
|
||||
|
|
28
install_simp_le.sh
Executable file
28
install_simp_le.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
apt-get update
|
||||
|
||||
# Install python packages needed by simp_le
|
||||
apt-get install -y -q --no-install-recommends python python-requests
|
||||
|
||||
# Install python packages needed to build simp_le
|
||||
apt-get install -y -q --no-install-recommends git gcc libssl-dev libffi-dev python-dev python-pip
|
||||
|
||||
# Get Let's Encrypt simp_le client source
|
||||
git -C /opt clone https://github.com/kuba/simp_le.git
|
||||
|
||||
cd /opt/simp_le
|
||||
# Upgrade setuptools
|
||||
pip install -U setuptools
|
||||
# Install simp_le in /usr/local/bin
|
||||
python ./setup.py install
|
||||
|
||||
# Make house cleaning
|
||||
rm -rf /opt/simp_le
|
||||
|
||||
apt-get autoremove -y git gcc libssl-dev libffi-dev python-dev python-pip
|
||||
|
||||
apt-get clean all
|
||||
rm -r /var/lib/apt/lists/*
|
|
@ -10,6 +10,7 @@ update_certs() {
|
|||
# Load relevant container settings
|
||||
source "$DIR"/letsencrypt_service_data
|
||||
|
||||
reload_nginx='false'
|
||||
for cid in "${LETSENCRYPT_CONTAINERS[@]}"; do
|
||||
# Derive host and email variable names
|
||||
host_varname="LETSENCRYPT_${cid}_HOST"
|
||||
|
@ -36,14 +37,15 @@ update_certs() {
|
|||
# Symlink to created certificate and key.
|
||||
ln -sf ./$domain/fullchain.pem /etc/nginx/certs/$domain".crt"
|
||||
ln -sf ./$domain/key.pem /etc/nginx/certs/$domain".key"
|
||||
|
||||
# Update certificates configuration in nginx
|
||||
/usr/local/bin/docker-gen -only-exposed /app/nginx.tmpl /etc/nginx/conf.d/default.conf
|
||||
nginx -s reload
|
||||
reload_nginx='true'
|
||||
fi
|
||||
done
|
||||
done
|
||||
unset LETSENCRYPT_CONTAINERS
|
||||
if [[ "$reload_nginx" == 'true' ]]; then
|
||||
/usr/local/bin/docker-gen -only-exposed /app/nginx.tmpl /etc/nginx/conf.d/default.conf
|
||||
nginx -s reload
|
||||
fi
|
||||
}
|
||||
|
||||
pid=
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
nginx -s reload
|
||||
|
||||
docker-gen \
|
||||
-only-exposed \
|
||||
-notify '/app/update_certs' \
|
||||
/app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data
|
||||
|
||||
nginx -s reload
|
||||
|
|
Loading…
Reference in a new issue