[openresty_integration] docker nginx proxy based on openresty.
This commit is contained in:
parent
0670a13d92
commit
7b36835188
5 changed files with 62 additions and 13 deletions
13
Dockerfile
13
Dockerfile
|
|
@ -1,17 +1,22 @@
|
||||||
FROM nginx:1.11.3
|
FROM openresty/openresty:jessie
|
||||||
MAINTAINER Jason Wilder mail@jasonwilder.com
|
|
||||||
|
|
||||||
# Install wget and install/updates certificates
|
# Install wget and install/updates certificates
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y -q --no-install-recommends \
|
&& apt-get install -y -q --no-install-recommends \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
|
unzip \
|
||||||
wget \
|
wget \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -r /var/lib/apt/lists/*
|
&& rm -r /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN /usr/local/openresty/luajit/bin/luarocks install date
|
||||||
|
RUN /usr/local/openresty/luajit/bin/luarocks install lua-resty-http
|
||||||
|
RUN /usr/local/openresty/luajit/bin/luarocks install lua-resty-jwt
|
||||||
|
|
||||||
# Configure Nginx and apply fix for very long server names
|
# Configure Nginx and apply fix for very long server names
|
||||||
RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
RUN mkdir -p /etc/nginx/conf.d
|
||||||
&& sed -i 's/^http {/&\n server_names_hash_bucket_size 128;/g' /etc/nginx/nginx.conf
|
RUN mkdir -p /var/log/nginx/
|
||||||
|
COPY nginx/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
|
||||||
|
|
||||||
# Install Forego
|
# Install Forego
|
||||||
ADD https://github.com/jwilder/forego/releases/download/v0.16.1/forego /usr/local/bin/forego
|
ADD https://github.com/jwilder/forego/releases/download/v0.16.1/forego /usr/local/bin/forego
|
||||||
|
|
|
||||||
5
Makefile
5
Makefile
|
|
@ -1,5 +1,5 @@
|
||||||
.SILENT :
|
.SILENT :
|
||||||
.PHONY : test
|
.PHONY : run
|
||||||
|
|
||||||
update-dependencies:
|
update-dependencies:
|
||||||
docker pull jwilder/docker-gen:0.7.3
|
docker pull jwilder/docker-gen:0.7.3
|
||||||
|
|
@ -12,3 +12,6 @@ update-dependencies:
|
||||||
test:
|
test:
|
||||||
docker build -t jwilder/nginx-proxy:bats .
|
docker build -t jwilder/nginx-proxy:bats .
|
||||||
bats test
|
bats test
|
||||||
|
|
||||||
|
run:
|
||||||
|
docker-compose up -d
|
||||||
|
|
|
||||||
4
Procfile
4
Procfile
|
|
@ -1,2 +1,2 @@
|
||||||
nginx: nginx
|
nginx: /usr/local/openresty/nginx/sbin/nginx
|
||||||
dockergen: docker-gen -watch -notify "nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf
|
dockergen: docker-gen -watch -notify "/usr/local/openresty/nginx/sbin/nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
version: '2'
|
version: '2'
|
||||||
services:
|
services:
|
||||||
nginx-proxy:
|
nginx-proxy:
|
||||||
image: jwilder/nginx-proxy
|
#image: jwilder/nginx-proxy
|
||||||
container_name: nginx-proxy
|
build: .
|
||||||
|
container_name: 0nginx-proxy
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||||
|
- "./nginx/vhost:/etc/nginx/vhost.d"
|
||||||
|
- "./nginx/lua:/usr/local/openresty/nginx/lua"
|
||||||
|
|
||||||
whoami:
|
swagger-ui:
|
||||||
image: jwilder/whoami
|
container_name: 0swagger-ui
|
||||||
|
image: schickling/swagger-ui
|
||||||
environment:
|
environment:
|
||||||
- VIRTUAL_HOST=whoami.local
|
API_URL: http://auth.presspage.dev/swagger.yml
|
||||||
|
VIRTUAL_HOST: swagger-ui.presspage.dev
|
||||||
|
|
|
||||||
37
nginx/nginx.conf
Normal file
37
nginx/nginx.conf
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
#user nobody;
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
#error_log logs/error.log;
|
||||||
|
#error_log logs/error.log notice;
|
||||||
|
#error_log logs/error.log info;
|
||||||
|
|
||||||
|
#pid logs/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
# '$status $body_bytes_sent "$http_referer" '
|
||||||
|
# '"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
#access_log logs/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
#keepalive_timeout 0;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue