From a1a9ec98d6e1547ec88a9b5949c6f4d1c279db59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Do=CC=88ring?= Date: Wed, 28 Nov 2018 16:54:00 +0100 Subject: [PATCH] Introduce custom base image To avoid discussions between the mainline guys and stable guys, this PR introduces customizable base images via build args. Closes #1189 --- Dockerfile | 3 ++- Dockerfile.alpine | 3 ++- README.md | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 45a09e3..049ddab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM nginx:1.14.1 +ARG BASE_IMAGE_TAG=1.14.1 +FROM nginx:$BASE_IMAGE_TAG LABEL maintainer="Jason Wilder mail@jasonwilder.com" # Install wget and install/updates certificates diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 23459a3..2265dce 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,4 +1,5 @@ -FROM nginx:1.14.1-alpine +ARG BASE_IMAGE_TAG=1.14.1-alpine +FROM nginx:$BASE_IMAGE_TAG LABEL maintainer="Jason Wilder mail@jasonwilder.com" # Install wget and install/updates certificates diff --git a/README.md b/README.md index a6504cd..3162a94 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,24 @@ This image is based on the nginx:alpine image. Use this image to fully support H $ docker pull jwilder/nginx-proxy:alpine +### Custom base image + +nginx-proxy runs with the latest stable nginx. You can build your own image and choose a different base image tag (e.g `1.15.7` or `1.15.7-alpine`). + +``` +# debian +$ docker build --build-arg BASE_IMAGE_TAG=1.15 -t nginx-proxy-test-1.15 . +$ docker run --rm nginx-proxy-test-1.15 nginx -v +nginx version: nginx/1.15.7 + +# alpine +$ docker build --build-arg BASE_IMAGE_TAG=1.15-alpine -t nginx-proxy-test-1.15 -f Dockerfile.alpine . +$ docker run --rm nginx-proxy-test-1.15 nginx -v +nginx version: nginx/1.15.7 +``` + +For docker-compose see [docs.docker.com/compose/compose-file](https://docs.docker.com/compose/compose-file/#args). + ### Docker Compose ```yaml