build-arg to define base-image, fix locale for Debian

This commit is contained in:
Matyas Markovics
2019-03-12 23:28:58 +01:00
parent 14394bcb3f
commit 4f65f0a270
3 changed files with 23 additions and 6 deletions

View File

@@ -1,12 +1,19 @@
NAME = phusion/baseimage NAME ?= phusion/baseimage
VERSION = 0.11 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 .PHONY: all build test tag_latest release ssh
all: build all: build
build: build:
docker build -t $(NAME):$(VERSION) --rm image docker build -t $(NAME):$(VERSION) --build-arg BASE_IMAGE=$(BASE_IMAGE) --rm image
test: test:
env NAME=$(NAME) VERSION=$(VERSION) ./test/runner.sh env NAME=$(NAME) VERSION=$(VERSION) ./test/runner.sh
@@ -23,7 +30,7 @@ ssh:
chmod 600 image/services/sshd/keys/insecure_key chmod 600 image/services/sshd/keys/insecure_key
@ID=$$(docker ps | grep -F "$(NAME):$(VERSION)" | awk '{ print $$1 }') && \ @ID=$$(docker ps | grep -F "$(NAME):$(VERSION)" | awk '{ print $$1 }') && \
if test "$$ID" = ""; then echo "Container is not running."; exit 1; fi && \ 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" && \ echo "SSHing into $$IP" && \
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i image/services/sshd/keys/insecure_key root@$$IP ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i image/services/sshd/keys/insecure_key root@$$IP

View File

@@ -1,4 +1,5 @@
FROM ubuntu:18.04 ARG BASE_IMAGE
FROM $BASE_IMAGE
MAINTAINER Phusion <info@phusion.nl> MAINTAINER Phusion <info@phusion.nl>
COPY . /bd_build COPY . /bd_build

View File

@@ -41,7 +41,16 @@ $minimal_apt_get_install software-properties-common
apt-get dist-upgrade -y --no-install-recommends -o Dpkg::Options::="--force-confold" apt-get dist-upgrade -y --no-install-recommends -o Dpkg::Options::="--force-confold"
## Fix locale. ## 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 locale-gen en_US
update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8
echo -n en_US.UTF-8 > /etc/container_environment/LANG echo -n en_US.UTF-8 > /etc/container_environment/LANG