diff --git a/Makefile b/Makefile index 1b00a21..0913ad8 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,19 @@ -NAME = phusion/baseimage -VERSION = 0.11 +NAME ?= phusion/baseimage +VERSION ?= 0.11 + +ifeq ($(origin BASE_IMAGE), undefined) +BASE_IMAGE = ubuntu:18.04 +else +NAME := $(NAME)-$(subst :,-,${BASE_IMAGE}) +endif + .PHONY: all build test tag_latest release ssh all: build build: - docker build -t $(NAME):$(VERSION) --rm image + docker build -t $(NAME):$(VERSION) --build-arg BASE_IMAGE=$(BASE_IMAGE) --rm image test: env NAME=$(NAME) VERSION=$(VERSION) ./test/runner.sh @@ -23,7 +30,7 @@ ssh: chmod 600 image/services/sshd/keys/insecure_key @ID=$$(docker ps | grep -F "$(NAME):$(VERSION)" | awk '{ print $$1 }') && \ if test "$$ID" = ""; then echo "Container is not running."; exit 1; fi && \ - IP=$$(docker inspect $$ID | grep IPAddr | sed 's/.*: "//; s/".*//') && \ + IP=$$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $$ID) && \ echo "SSHing into $$IP" && \ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i image/services/sshd/keys/insecure_key root@$$IP diff --git a/image/Dockerfile b/image/Dockerfile index da5b41d..7583510 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -1,4 +1,5 @@ -FROM ubuntu:18.04 +ARG BASE_IMAGE +FROM $BASE_IMAGE MAINTAINER Phusion COPY . /bd_build diff --git a/image/prepare.sh b/image/prepare.sh index c2926a5..d7a383b 100755 --- a/image/prepare.sh +++ b/image/prepare.sh @@ -41,7 +41,16 @@ $minimal_apt_get_install software-properties-common apt-get dist-upgrade -y --no-install-recommends -o Dpkg::Options::="--force-confold" ## Fix locale. -$minimal_apt_get_install language-pack-en +case $(lsb_release -is) in + Ubuntu) + $minimal_apt_get_install language-pack-en + ;; + Debian) + $minimal_apt_get_install locales locales-all + ;; + *) + ;; +esac locale-gen en_US update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 echo -n en_US.UTF-8 > /etc/container_environment/LANG