2017-05-04 16:57:00 +00:00
|
|
|
FROM nginx:1.13.0
|
2015-10-29 19:32:09 +00:00
|
|
|
MAINTAINER Jason Wilder mail@jasonwilder.com
|
2014-05-05 16:59:23 +00:00
|
|
|
|
2014-11-26 22:53:35 +00:00
|
|
|
# Install wget and install/updates certificates
|
|
|
|
RUN apt-get update \
|
2014-11-22 18:42:54 +00:00
|
|
|
&& apt-get install -y -q --no-install-recommends \
|
|
|
|
ca-certificates \
|
|
|
|
wget \
|
|
|
|
&& apt-get clean \
|
|
|
|
&& rm -r /var/lib/apt/lists/*
|
|
|
|
|
2017-06-14 22:31:12 +00:00
|
|
|
|
2015-01-02 04:15:40 +00:00
|
|
|
# Configure Nginx and apply fix for very long server names
|
2014-11-22 18:42:54 +00:00
|
|
|
RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
2017-06-12 07:59:55 +00:00
|
|
|
&& sed -i 's/^http {/&\n server_names_hash_bucket_size 128;/g' /etc/nginx/nginx.conf \
|
|
|
|
&& sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf
|
2014-11-22 18:42:54 +00:00
|
|
|
|
2014-12-24 12:21:40 +00:00
|
|
|
# Install Forego
|
2016-04-04 22:48:52 +00:00
|
|
|
ADD https://github.com/jwilder/forego/releases/download/v0.16.1/forego /usr/local/bin/forego
|
|
|
|
RUN chmod u+x /usr/local/bin/forego
|
2014-05-05 16:59:23 +00:00
|
|
|
|
2016-06-13 06:22:50 +00:00
|
|
|
ENV DOCKER_GEN_VERSION 0.7.3
|
2014-06-07 19:53:16 +00:00
|
|
|
|
2014-11-22 18:42:54 +00:00
|
|
|
RUN wget https://github.com/jwilder/docker-gen/releases/download/$DOCKER_GEN_VERSION/docker-gen-linux-amd64-$DOCKER_GEN_VERSION.tar.gz \
|
|
|
|
&& tar -C /usr/local/bin -xvzf docker-gen-linux-amd64-$DOCKER_GEN_VERSION.tar.gz \
|
|
|
|
&& rm /docker-gen-linux-amd64-$DOCKER_GEN_VERSION.tar.gz
|
2014-06-03 22:30:05 +00:00
|
|
|
|
2014-11-22 18:42:54 +00:00
|
|
|
COPY . /app/
|
|
|
|
WORKDIR /app/
|
2014-09-17 18:37:39 +00:00
|
|
|
|
2014-05-05 16:59:23 +00:00
|
|
|
ENV DOCKER_HOST unix:///tmp/docker.sock
|
|
|
|
|
2017-01-12 03:39:04 +00:00
|
|
|
VOLUME ["/etc/nginx/certs", "/etc/nginx/dhparam"]
|
Add SSL support
This adds SSL support for containers. It supports single host
certificates, wildcards and SNI using naming conventions for
certificates or optionally specify a cert name (for SNI). The SSL
cipher configuration is based on mozilla intermediate profile which
should provide compatibility with clients back to Firefox 1, Chrome 1,
IE 7, Opera 5, Safari 1, Windows XP IE8, Android 2.3, Java 7. The
configuration also enables OCSP stapling, HSTS, and ssl session caches.
To enable SSL, nginx-proxy should be started w/ -p 443:443 and -v
/path/to/certs:/etc/nginx/certs. Certificates must be named:
<virtualhost>.crt and <virtualhost>.key where <virtualhost> matches
the a value of VIRTUAL_HOST on a container.
For wildcard certificates, the certificate and private key should be
named after the wildcard domain with .crt and .key suffixes. For example,
*.example.com should be name example.com.crt and example.com.key.
For SNI where a certificate may be used for multiple domain names, the
container can specify a CERT_NAME env var that corresponds to the base
file name of the certificate and key. For example, if you have a cert
allowing *.example.com and *.bar.com, it can be name shared.crt and
shared.key. A container can use that cert by having CERT_NAME=shared and
VIRTUAL_HOST=foo.example.com. The name "shared" is arbitrary and can
be whatever makes sense.
The behavior for the proxy when port 80 and 443 is defined is as
follows:
* If a container has a usable cert, port 80 will redirect to
443 for that container to always prefer HTTPS when available.
* If the container does not have a usable cert 503 will be returned.
In the last case, a self-signed or generic cert can be defined as
"default.crt" and "default.key" which will allow a client browser to
at least make a SSL connection.
2014-11-26 17:38:51 +00:00
|
|
|
|
2015-09-11 22:05:54 +00:00
|
|
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
2015-09-12 14:18:12 +00:00
|
|
|
CMD ["forego", "start", "-r"]
|