-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.template
51 lines (43 loc) · 1.54 KB
/
Dockerfile.template
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
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
if [ -n "$1" ]; then
if [ -f "$1" ]; then
source $1
fi
fi
DOCKER_FILE=${DOCKER_FILE:-"Dockerfile"}
DOCKER_FROM=${DOCKER_FROM:-"rawmind/alpine-monit:5.32-0"}
cat << EOF > ${DOCKER_FILE}
FROM ${DOCKER_FROM}
MAINTAINER Raul Sanchez <[email protected]>
#Set environment
ENV SERVICE_VERSION=1.23.0 \
SERVICE_NAME=nginx \
SERVICE_HOME=/opt/nginx \
SERVICE_URL=http://nginx.org/download
ENV PATH=\${PATH}:\${SERVICE_HOME}/bin
# Compile and install nginx
RUN apk add --update gcc musl-dev make libressl-dev pcre pcre-dev zlib-dev\
&& mkdir -p /opt/src \${SERVICE_HOME}/www \${SERVICE_HOME}/sites \${SERVICE_HOME}/certs; cd /opt/src \
&& curl -sS \${SERVICE_URL}/nginx-\${SERVICE_VERSION}.tar.gz | gunzip -c - | tar -xf - \
&& cd /opt/src/nginx-\${SERVICE_VERSION} \
&& ./configure \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_v2_module \
--prefix=\${SERVICE_HOME} \
--modules-path=\${SERVICE_HOME}/modules \
--http-log-path=\${SERVICE_HOME}/log/access.log \
--error-log-path=\${SERVICE_HOME}/log/error.log \
--sbin-path=\${SERVICE_HOME}/bin/nginx \
--pid-path=\${SERVICE_HOME}/run/nginx.pid \
--lock-path=\${SERVICE_HOME}/run/nginx.lock \
&& make -j2 \
&& make install \
&& apk del gcc musl-dev make libressl-dev pcre-dev zlib-dev \
&& rm -rf /opt/src /var/cache/apk/* \${SERVICE_HOME}/conf/nginx.conf
# Add config files
ADD root /
RUN chmod +x \${SERVICE_HOME}/bin/*.sh
WORKDIR \$SERVICE_HOME
EXPOSE 8080 8443
EOF