From 809b83a73f4736f49ed0554b30eff167b457389f Mon Sep 17 00:00:00 2001 From: Li Chuangbo Date: Wed, 6 Apr 2016 01:28:47 +1200 Subject: [PATCH] Add alpine image Alpine linux is a tiny linux distribution which ideal for building docker images. for more commit details, this commit: - Build from nginx:alpine (nginx:alpine does not have versions) - Add full nginx.conf as nginx:alpine has a different nginx.conf then debian - Download forego in Dockerfile for better building caching - Change badge version ;-) --- Dockerfile | 18 +++++++----------- Makefile | 2 +- README.md | 2 +- nginx.conf | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 5691ec6..f812576 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,18 @@ -FROM nginx:1.9.12 +FROM nginx:alpine MAINTAINER Jason Wilder mail@jasonwilder.com # Install wget and install/updates certificates -RUN apt-get update \ - && apt-get install -y -q --no-install-recommends \ +RUN apk add --no-cache --virtual .run-deps \ ca-certificates \ - wget \ - && apt-get clean \ - && rm -r /var/lib/apt/lists/* + bash # 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 +COPY nginx.conf /etc/nginx/ +RUN mkdir /etc/nginx/conf.d # Install Forego -ADD https://github.com/jwilder/forego/releases/download/v0.16.1/forego /usr/local/bin/forego -RUN chmod u+x /usr/local/bin/forego - +RUN wget https://github.com/jwilder/forego/releases/download/v0.16.1/forego -O /usr/local/bin/forego \ + && chmod u+x /usr/local/bin/forego ENV DOCKER_GEN_VERSION 0.7.0 RUN wget https://github.com/jwilder/docker-gen/releases/download/$DOCKER_GEN_VERSION/docker-gen-linux-amd64-$DOCKER_GEN_VERSION.tar.gz \ diff --git a/Makefile b/Makefile index 213a441..91e8987 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ update-dependencies: docker pull jwilder/docker-gen:0.7.0 - docker pull nginx:1.9.12 + docker pull nginx:alpine docker pull python:3 docker pull rancher/socat-docker:latest docker pull appropriate/curl:latest diff --git a/README.md b/README.md index d277421..98f782a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![nginx 1.9.12](https://img.shields.io/badge/nginx-1.9.12-brightgreen.svg) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg) [![Build](https://circleci.com/gh/jwilder/nginx-proxy.svg?&style=shield&circle-token=2da3ee844076a47371bd45da81cf27409ca7306a)](https://circleci.com/gh/jwilder/nginx-proxy) [![Build Status](https://travis-ci.org/jwilder/nginx-proxy.svg?branch=master)](https://travis-ci.org/jwilder/nginx-proxy) +![nginx alpine](https://img.shields.io/badge/nginx-alpine-brightgreen.svg) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg) [![Build](https://circleci.com/gh/jwilder/nginx-proxy.svg?&style=shield&circle-token=2da3ee844076a47371bd45da81cf27409ca7306a)](https://circleci.com/gh/jwilder/nginx-proxy) [![Build Status](https://travis-ci.org/jwilder/nginx-proxy.svg?branch=master)](https://travis-ci.org/jwilder/nginx-proxy) nginx-proxy sets up a container running nginx and [docker-gen][1]. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped. diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..f16c604 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,40 @@ + +daemon off; + +#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 { + server_names_hash_bucket_size 128; + + 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 conf.d/*.conf; +}