diff --git a/Dockerfile b/Dockerfile index 6d5ce9b..dc4fe03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,22 @@ -FROM nginx:1.11.3 -MAINTAINER Jason Wilder mail@jasonwilder.com +FROM openresty/openresty:jessie # Install wget and install/updates certificates RUN apt-get update \ && apt-get install -y -q --no-install-recommends \ ca-certificates \ + unzip \ wget \ && apt-get clean \ && 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 -RUN echo "daemon off;" >> /etc/nginx/nginx.conf \ - && sed -i 's/^http {/&\n server_names_hash_bucket_size 128;/g' /etc/nginx/nginx.conf +RUN mkdir -p /etc/nginx/conf.d +RUN mkdir -p /var/log/nginx/ +COPY nginx/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf # Install Forego ADD https://github.com/jwilder/forego/releases/download/v0.16.1/forego /usr/local/bin/forego diff --git a/Makefile b/Makefile index 74ae6bf..3559c9a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .SILENT : -.PHONY : test +.PHONY : run update-dependencies: docker pull jwilder/docker-gen:0.7.3 @@ -12,3 +12,6 @@ update-dependencies: test: docker build -t jwilder/nginx-proxy:bats . bats test + +run: + docker-compose up -d diff --git a/Procfile b/Procfile index 0fa56e7..20bb980 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -nginx: nginx -dockergen: docker-gen -watch -notify "nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf +nginx: /usr/local/openresty/nginx/sbin/nginx +dockergen: docker-gen -watch -notify "/usr/local/openresty/nginx/sbin/nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf diff --git a/docker-compose.yml b/docker-compose.yml index 044f022..474b93e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,15 +1,19 @@ version: '2' services: nginx-proxy: - image: jwilder/nginx-proxy - container_name: nginx-proxy + #image: jwilder/nginx-proxy + build: . + container_name: 0nginx-proxy ports: - "80:80" volumes: - /var/run/docker.sock:/tmp/docker.sock:ro + - "./nginx/vhost:/etc/nginx/vhost.d" + - "./nginx/lua:/usr/local/openresty/nginx/lua" - whoami: - image: jwilder/whoami + swagger-ui: + container_name: 0swagger-ui + image: schickling/swagger-ui environment: - - VIRTUAL_HOST=whoami.local - + API_URL: http://auth.presspage.dev/swagger.yml + VIRTUAL_HOST: swagger-ui.presspage.dev diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..02c08b7 --- /dev/null +++ b/nginx/nginx.conf @@ -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; + +}