Skip to content

Instantly share code, notes, and snippets.

@LukeFlynn
Last active August 6, 2016 20:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LukeFlynn/933c96be4deba0ab89575c358cc88cea to your computer and use it in GitHub Desktop.
Save LukeFlynn/933c96be4deba0ab89575c358cc88cea to your computer and use it in GitHub Desktop.
Alpine Nginx
FROM alpine:3.3
MAINTAINER Luke Flynn <luke@lukehflynn.com>
ENV apk_list="autoconf wget ca-certificates pcre zlib zip tar openssl-dev pcre-dev zlib-dev build-base git patch bash gperf python linux-headers gcc"
RUN apk add --no-cache ${apk_list}
WORKDIR /tmp
# Download Nginx and Nginx modules source
RUN mkdir -p /usr/local/src/nginx && \
wget http://nginx.org/download/nginx-1.10.1.tar.gz -O nginx.tar.gz && \
tar -xzvf nginx.tar.gz -C /usr/local/src/nginx
# Build Nginx
WORKDIR /usr/local/src/nginx/nginx-1.10.1
RUN ./configure \
--prefix=/usr/share/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/run/nginx.pid \
--lock-path=/run/lock/subsys/nginx \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-pcre \
--with-ipv6 \
--with-http_dav_module \
--with-http_v2_module \
--with-http_gunzip_module && \
make && \
make install
WORKDIR /usr/local/src/nginx
RUN touch /run/nginx.pid
RUN rm -rf /etc/nginx/nginx.conf
RUN mkdir /var/pagespeed_cache
ADD ./nginx.conf /etc/nginx/nginx.conf
# Cleanup after Nginx build
#RUN apk del ${apk_list}
# PORTS
EXPOSE 80 443
ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment