Skip to content

Commit 72084c4

Browse files
committed
Added nginx openresty docker
1 parent 23c8652 commit 72084c4

File tree

5 files changed

+79
-8
lines changed

5 files changed

+79
-8
lines changed

build

Lines changed: 0 additions & 8 deletions
This file was deleted.

openresty/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

openresty/Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#
2+
# Openresty dockerfile
3+
#
4+
# This docker contains openresty (nginx) compiled from source with useful optional modules installed.
5+
#
6+
# http://github.com/marclennox/docker-images/openresty
7+
#
8+
9+
# Pull base image.
10+
FROM debian:jessie
11+
12+
MAINTAINER Marc Lennox <[email protected]>
13+
14+
# Set environment.
15+
ENV DEBIAN_FRONTEND noninteractive
16+
17+
# Install packages.
18+
RUN apt-get update
19+
RUN apt-get install -y build-essential curl libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl wget
20+
21+
# Compile pcre from source.
22+
RUN \
23+
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && \
24+
tar zxvf pcre-*.tar.gz && \
25+
rm -f pcre-*.tar.gz && \
26+
cd pcre-* && \
27+
./configure && \
28+
make && \
29+
make install && \
30+
make clean && \
31+
cd .. && \
32+
rm -rf pcre-* && \
33+
ln -s /usr/local/lib/libpcre.so.1 /lib64
34+
35+
# Compile openresty from source.
36+
RUN \
37+
wget http://openresty.org/download/ngx_openresty-1.7.2.1.tar.gz && \
38+
tar -xzvf ngx_openresty-*.tar.gz && \
39+
rm -f ngx_openresty-*.tar.gz && \
40+
cd ngx_openresty-* && \
41+
./configure && \
42+
make && \
43+
make install && \
44+
make clean && \
45+
cd .. && \
46+
rm -rf ngx_openresty-* && \
47+
ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx
48+
49+
# Add files to the container.
50+
ADD ./script/ /usr/local/bin
51+
52+
# Expose volumes.
53+
VOLUME ["/etc/nginx"]
54+
55+
# Set the working directory.
56+
WORKDIR /etc/nginx
57+
58+
# Set the entrypoint script.
59+
ENTRYPOINT ["docker-entrypoint"]
60+
61+
# Define the default command.
62+
CMD ["nginx", "-c", "/etc/nginx/nginx.conf"]

openresty/build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
4+
cd "${SCRIPT_DIR}" && docker build --tag="marclennox/openresty" .

openresty/script/docker-entrypoint

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Copy a default configuration into place if not present
5+
if ! [ "$(ls -A .)" ]; then
6+
cp -upR "/usr/local/openresty/nginx/conf/." "/etc/nginx/"
7+
echo "daemon off;" >> "/etc/nginx/nginx.conf"
8+
fi
9+
10+
command="$@"
11+
12+
${command}

0 commit comments

Comments
 (0)