From 36bd41108f67686d2ebd019b6b00421a95330bef Mon Sep 17 00:00:00 2001 From: Matyas Markovics Date: Mon, 8 Apr 2019 09:45:37 +0200 Subject: [PATCH] Default to ubuntu BASE_IMAGE in Dockerfile, modify make to only add --build-arg to build target if BASE_IMAGE is defined, document the use of BASE_IMAGE in README --- Makefile | 13 +++++++------ README.md | 13 +++++++++++++ image/Dockerfile | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 585d2d5..0aef4ef 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ -ifndef BASE_IMAGE - BASE_IMAGE = ubuntu:18.04 - NAME ?= phusion/baseimage -else ifdef NAME -else +ifdef BASE_IMAGE + BUILD_ARG = --build-arg BASE_IMAGE=$(BASE_IMAGE) +ifndef NAME NAME = phusion/baseimage-$(subst :,-,${BASE_IMAGE}) endif +else + NAME ?= phusion/baseimage +endif VERSION ?= 0.11 @@ -13,7 +14,7 @@ VERSION ?= 0.11 all: build build: - docker build -t $(NAME):$(VERSION) --build-arg BASE_IMAGE=$(BASE_IMAGE) --rm image + docker build -t $(NAME):$(VERSION) $(BUILD_ARG) --rm image test: env NAME=$(NAME) VERSION=$(VERSION) ./test/runner.sh diff --git a/README.md b/README.md index 76baa0f..57d9780 100644 --- a/README.md +++ b/README.md @@ -597,6 +597,19 @@ If you want to call the resulting image something else, pass the NAME variable, make build NAME=joe/baseimage +You can also change the `ubuntu` base-image to `debian` as these distributions are quite similar. + + make build BASE_IMAGE=debian:stretch + +The image will be: `phusion/baseimage-debian-stretch`. Use the `NAME` variable in combination with the `BASE_IMAGE` one to call it `joe/stretch`. + + make build BASE_IMAGE=debian:stretch NAME=joe/stretch + +To verify that the various services are started, when the image is run as a container, add `test` to the end of your make invocations, e.g.: + + make build BASE_IMAGE=debian:stretch NAME=joe/stretch test + + ### Removing optional services diff --git a/image/Dockerfile b/image/Dockerfile index 7583510..07a7241 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE +ARG BASE_IMAGE=ubuntu:18.04 FROM $BASE_IMAGE MAINTAINER Phusion