Browse Source

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
changes/72/641472/7
Drew Walters 2 months ago
parent
commit
ac997fd6ec
3 changed files with 24 additions and 15 deletions
  1. 15
    14
      Makefile
  2. 3
    1
      images/drydock/Dockerfile
  3. 6
    0
      tools/drydock_image_build.sh

+ 15
- 14
Makefile View File

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

+ 3
- 1
images/drydock/Dockerfile View File

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

+ 6
- 0
tools/drydock_image_build.sh View File

@@ -1,6 +1,7 @@
1 1
 #!/bin/bash
2 2
 set -x
3 3
 
4
+UBUNTU_BASE_IMAGE=${UBUNTU_BASE_IMAGE:-""}
4 5
 UBUNTU_REPO=${UBUNTU_REPO:-""}
5 6
 TRUSTED_UBUNTU_REPO=${TRUSTED_UBUNTU_REPO:-"no"}
6 7
 ALLOW_UNATHENTICATED=${ALLOW_UNAUTHENTICATED:-"false"}
@@ -9,6 +10,11 @@ PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST:-""}
9 10
 
10 11
 ADDL_BUILD_ARGS=""
11 12
 
13
+if [[ ! -z "${UBUNTU_BASE_IMAGE}" ]]
14
+then
15
+  ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS} --build-arg FROM=${UBUNTU_BASE_IMAGE}"
16
+fi
17
+
12 18
 if [[ ! -z "${UBUNTU_REPO}" ]]
13 19
 then
14 20
   ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS} --build-arg UBUNTU_REPO=${UBUNTU_REPO}"

Loading…
Cancel
Save