-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
41 lines (30 loc) · 1.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM ubuntu:16.04
MAINTAINER Michael Baudino <[email protected]>
# disable source repositories
RUN sed -i 's/^deb-src/# deb-src/' /etc/apt/sources.list
# install required packages
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
nginx \
letsencrypt \
&& rm -rf /var/lib/apt/lists/*
# disable default nginx config
RUN rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default
# add nginx config files
COPY nginx-config/* /etc/nginx/sites-available/
RUN ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
# copy letsencrypt wrapper scripts
COPY bin/letsencrypt-* /usr/local/bin/
# expose HTTP(S) ports
EXPOSE 80 443
ENV HSTS true
# entrypoint that takes care of replacing placeholders in nginx
# configuration files with values from environment variables
# (works with both docker-compose `up` and `run` commands)
COPY nginx-config-replacer /usr/local/bin/
ENTRYPOINT ["nginx-config-replacer"]
# start nginx in foreground
CMD ["nginx", "-g", "daemon off;"]