images: Allow base image substitution for Drydock

Currently, Drydock images are built using the Ubuntu:16.04 base image.
This change allows users to specify different base images using the
UBUNTU_BASE_IMAGE build argument.

Change-Id: I9ddaa89eb5262571703a3dbf7ebb6deed1505842
This commit is contained in:
Drew Walters 2019-03-06 13:05:28 -06:00
parent ebe95d1875
commit ac997fd6ec
3 changed files with 24 additions and 15 deletions

View File

@ -12,21 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BUILD_DIR := $(shell mkdir -p build && mktemp -d -p build)
DOCKER_REGISTRY ?= quay.io
IMAGE_NAME ?= drydock
IMAGE_PREFIX ?= airshipit
IMAGE_TAG ?= dev
HELM := $(shell realpath $(BUILD_DIR))/helm
PROXY ?= http://proxy.foo.com:8000
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
USE_PROXY ?= false
PUSH_IMAGE ?= false
BUILD_DIR := $(shell mkdir -p build && mktemp -d -p build)
DOCKER_REGISTRY ?= quay.io
IMAGE_NAME ?= drydock
IMAGE_PREFIX ?= airshipit
IMAGE_TAG ?= dev
HELM := $(shell realpath $(BUILD_DIR))/helm
UBUNTU_BASE_IMAGE ?=
PROXY ?= http://proxy.foo.com:8000
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
USE_PROXY ?= false
PUSH_IMAGE ?= false
# use this variable for image labels added in internal build process
LABEL ?= org.airshipit.build=community
COMMIT ?= $(shell git rev-parse HEAD)
IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
GO_BUILDER ?= docker.io/golang:1.10-stretch
LABEL ?= org.airshipit.build=community
COMMIT ?= $(shell git rev-parse HEAD)
IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
GO_BUILDER ?= docker.io/golang:1.10-stretch
export

View File

@ -11,7 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:16.04
ARG FROM=ubuntu:16.04
FROM ${FROM}
LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode'
LABEL org.opencontainers.image.url='https://airshipit.org'

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -x
UBUNTU_BASE_IMAGE=${UBUNTU_BASE_IMAGE:-""}
UBUNTU_REPO=${UBUNTU_REPO:-""}
TRUSTED_UBUNTU_REPO=${TRUSTED_UBUNTU_REPO:-"no"}
ALLOW_UNATHENTICATED=${ALLOW_UNAUTHENTICATED:-"false"}
@ -9,6 +10,11 @@ PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST:-""}
ADDL_BUILD_ARGS=""
if [[ ! -z "${UBUNTU_BASE_IMAGE}" ]]
then
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS} --build-arg FROM=${UBUNTU_BASE_IMAGE}"
fi
if [[ ! -z "${UBUNTU_REPO}" ]]
then
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS} --build-arg UBUNTU_REPO=${UBUNTU_REPO}"