From dcbcb99055aaed2e75e2d751ad020fc3307d85ce Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Wed, 17 Feb 2021 15:21:58 +0100 Subject: [PATCH] Add possibility to build from BASE_IMAGE --- Makefile | 5 +++-- build/docker/bin/Dockerfile | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e97c0f16..714463e9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ BIN_IMAGE = blockbook-build DEB_IMAGE = blockbook-build-deb PACKAGER = $(shell id -u):$(shell id -g) +BASE_IMAGE = $$(awk -F= '$$1=="ID" { print $$2 ;}' /etc/os-release):$$(awk -F= '$$1=="VERSION_ID" { print $$2 ;}' /etc/os-release | tr -d '"') NO_CACHE = false TCMALLOC = ARGS ?= @@ -44,8 +45,8 @@ build-images: clean-images .bin-image: @if [ $$(build/tools/image_status.sh $(BIN_IMAGE):latest build/docker) != "ok" ]; then \ - echo "Building image $(BIN_IMAGE)..."; \ - docker build --no-cache=$(NO_CACHE) --build-arg TCMALLOC=$(TCMALLOC) -t $(BIN_IMAGE) build/docker/bin; \ + echo "Building image $(BIN_IMAGE) from $(BASE_IMAGE)"; \ + docker build --no-cache=$(NO_CACHE) --build-arg TCMALLOC=$(TCMALLOC) --build-arg BASE_IMAGE=$(BASE_IMAGE) -t $(BIN_IMAGE) build/docker/bin; \ else \ echo "Image $(BIN_IMAGE) is up to date"; \ fi diff --git a/build/docker/bin/Dockerfile b/build/docker/bin/Dockerfile index 122028af..ce604b84 100644 --- a/build/docker/bin/Dockerfile +++ b/build/docker/bin/Dockerfile @@ -1,6 +1,6 @@ -# initialize from the image - -FROM debian:9 +# initialize from the image defined by BASE_IMAGE +ARG BASE_IMAGE +FROM $BASE_IMAGE RUN apt-get update && \ apt-get upgrade -y && \