summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-07-25 00:51:49 +0000
committerGerrit Code Review <review@openstack.org>2018-07-25 00:51:49 +0000
commit10d4966810bab5d815245820db7dc5ae160e6c4f (patch)
tree168e08999dc04dd497f058d10c5707c47d8bd7c3
parentca4e22d24067796bbbe91c1efb0bb3ce505cc9a0 (diff)
parentbfa8c97d3a309bdb2bcb83b6409ca76252e876b4 (diff)
Merge "Update Dockerfile to allow override of FROM variable"
-rw-r--r--Makefile48
-rw-r--r--images/maas-rack-controller/Dockerfile3
-rw-r--r--images/maas-region-controller/Dockerfile3
-rw-r--r--images/sstream-cache/Dockerfile3
-rw-r--r--tools/gate/playbooks/docker-image-build.yaml37
-rw-r--r--tools/gate/playbooks/files/docker-systemd.conf8
-rw-r--r--tools/gate/playbooks/vars.yaml20
7 files changed, 96 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 69b4a44..67adac3 100644
--- a/Makefile
+++ b/Makefile
@@ -12,25 +12,26 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15DOCKER_REGISTRY ?= quay.io 15DOCKER_REGISTRY ?= quay.io
16REGION_SUFFIX ?= maas-region 16REGION_SUFFIX ?= maas-region
17IMG_COMMON_DIR ?= images 17IMG_COMMON_DIR ?= images
18REGION_IMG_DIR ?= images/maas-region-controller 18REGION_IMG_DIR ?= images/maas-region-controller
19RACK_SUFFIX ?= maas-rack 19RACK_SUFFIX ?= maas-rack
20RACK_IMG_DIR ?= images/maas-rack-controller 20RACK_IMG_DIR ?= images/maas-rack-controller
21CACHE_SUFFIX ?= maas-cache 21CACHE_SUFFIX ?= maas-cache
22CACHE_IMG_DIR ?= images/sstream-cache 22CACHE_IMG_DIR ?= images/sstream-cache
23IMAGE_PREFIX ?= airshipit 23IMAGE_PREFIX ?= airshipit
24IMAGE_TAG ?= untagged 24IMAGE_TAG ?= untagged
25PROXY ?= http://proxy.foo.com:8000 25PROXY ?= http://proxy.foo.com:8000
26NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local 26NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
27USE_PROXY ?= false 27USE_PROXY ?= false
28PUSH_IMAGE ?= false 28PUSH_IMAGE ?= false
29LABEL ?= commit-id 29LABEL ?= commit-id
30IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache 30IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache
31BUILD_DIR := $(shell mktemp -d) 31BUILD_DIR := $(shell mktemp -d)
32HELM := $(BUILD_DIR)/helm 32HELM := $(BUILD_DIR)/helm
33SSTREAM_IMAGE := "https://images.maas.io/ephemeral-v3/daily/" 33SSTREAM_IMAGE := "https://images.maas.io/ephemeral-v3/daily/"
34UBUNTU_BASE_IMAGE ?= ubuntu:16.04
34 35
35.PHONY: images 36.PHONY: images
36#Build all images in the list 37#Build all images in the list
@@ -66,16 +67,21 @@ helm-install:
66.PHONY: build 67.PHONY: build
67build: 68build:
68ifeq ($(USE_PROXY), true) 69ifeq ($(USE_PROXY), true)
69 docker build -t $(IMAGE) --network=host --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \ 70 docker build -t $(IMAGE) --network=host --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \
71 --build-arg FROM=$(UBUNTU_BASE_IMAGE) \
70 --build-arg http_proxy=$(PROXY) \ 72 --build-arg http_proxy=$(PROXY) \
71 --build-arg https_proxy=$(PROXY) \ 73 --build-arg https_proxy=$(PROXY) \
72 --build-arg HTTP_PROXY=$(PROXY) \ 74 --build-arg HTTP_PROXY=$(PROXY) \
73 --build-arg HTTPS_PROXY=$(PROXY) \ 75 --build-arg HTTPS_PROXY=$(PROXY) \
74 --build-arg no_proxy=$(NO_PROXY) \ 76 --build-arg no_proxy=$(NO_PROXY) \
75 --build-arg NO_PROXY=$(NO_PROXY) \ 77 --build-arg NO_PROXY=$(NO_PROXY) \
78 --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
76 $(IMAGE_DIR) 79 $(IMAGE_DIR)
77else 80else
78 docker build -t $(IMAGE) --network=host --label $(LABEL) --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) -f $(IMAGE_DIR)/Dockerfile $(IMAGE_DIR) 81 docker build -t $(IMAGE) --network=host --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \
82 --build-arg FROM=$(UBUNTU_BASE_IMAGE) \
83 --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
84 $(IMAGE_DIR)
79endif 85endif
80ifeq ($(PUSH_IMAGE), true) 86ifeq ($(PUSH_IMAGE), true)
81 docker push $(IMAGE) 87 docker push $(IMAGE)
diff --git a/images/maas-rack-controller/Dockerfile b/images/maas-rack-controller/Dockerfile
index 720d2f0..c808df4 100644
--- a/images/maas-rack-controller/Dockerfile
+++ b/images/maas-rack-controller/Dockerfile
@@ -1,4 +1,5 @@
1FROM ubuntu:16.04 1ARG FROM=ubuntu:16.04
2FROM ${FROM}
2 3
3ENV DEBIAN_FRONTEND noninteractive 4ENV DEBIAN_FRONTEND noninteractive
4ENV container docker 5ENV container docker
diff --git a/images/maas-region-controller/Dockerfile b/images/maas-region-controller/Dockerfile
index 66f6bd5..4e99704 100644
--- a/images/maas-region-controller/Dockerfile
+++ b/images/maas-region-controller/Dockerfile
@@ -1,4 +1,5 @@
1FROM ubuntu:16.04 1ARG FROM=ubuntu:16.04
2FROM ${FROM}
2 3
3ENV DEBIAN_FRONTEND noninteractive 4ENV DEBIAN_FRONTEND noninteractive
4ENV container docker 5ENV container docker
diff --git a/images/sstream-cache/Dockerfile b/images/sstream-cache/Dockerfile
index d1f145a..2e0bdba 100644
--- a/images/sstream-cache/Dockerfile
+++ b/images/sstream-cache/Dockerfile
@@ -1,4 +1,5 @@
1FROM ubuntu:16.04 1ARG FROM=ubuntu:16.04
2FROM ${FROM}
2 3
3ARG SSTREAM_IMAGE=https://images.maas.io/ephemeral-v3/daily/ 4ARG SSTREAM_IMAGE=https://images.maas.io/ephemeral-v3/daily/
4ENV IMAGE_SRC ${SSTREAM_IMAGE} 5ENV IMAGE_SRC ${SSTREAM_IMAGE}
diff --git a/tools/gate/playbooks/docker-image-build.yaml b/tools/gate/playbooks/docker-image-build.yaml
index 7f4af61..31806f1 100644
--- a/tools/gate/playbooks/docker-image-build.yaml
+++ b/tools/gate/playbooks/docker-image-build.yaml
@@ -14,6 +14,8 @@
14 14
15- hosts: primary 15- hosts: primary
16 tasks: 16 tasks:
17 - include_vars: vars.yaml
18
17 - name: Debug tag generation inputs 19 - name: Debug tag generation inputs
18 block: 20 block:
19 - debug: 21 - debug:
@@ -39,16 +41,47 @@
39 var: image_tags 41 var: image_tags
40 42
41 - name: Install Docker (Debian) 43 - name: Install Docker (Debian)
44 when: ansible_os_family == 'Debian'
42 block: 45 block:
46 - file:
47 path: "{{ item }}"
48 state: directory
49 with_items:
50 - /etc/docker/
51 - /etc/systemd/system/docker.service.d/
52 - /var/lib/docker/
53 - mount:
54 path: /var/lib/docker/
55 src: tmpfs
56 fstype: tmpfs
57 opts: size=25g
58 state: mounted
59 - copy: "{{ item }}"
60 with_items:
61 - content: "{{ docker_daemon | to_json }}"
62 dest: /etc/docker/daemon.json
63 - src: files/docker-systemd.conf
64 dest: /etc/systemd/system/docker.service.d/
65 - apt_key:
66 url: https://download.docker.com/linux/ubuntu/gpg
67 - apt_repository:
68 repo: deb http://{{ zuul_site_mirror_fqdn }}/deb-docker xenial stable
43 - apt: 69 - apt:
44 name: "{{ item }}" 70 name: "{{ item }}"
71 allow_unauthenticated: True
45 with_items: 72 with_items:
46 - docker.io 73 - docker-ce
47 - python-pip 74 - python-pip
48 when: ansible_os_family == 'Debian'
49 - pip: 75 - pip:
50 name: docker 76 name: docker
51 version: 2.7.0 77 version: 2.7.0
78 # NOTE(SamYaple): Allow all connections from containers to host so the
79 # containers can access the http server for git and wheels
80 - iptables:
81 action: insert
82 chain: INPUT
83 in_interface: docker0
84 jump: ACCEPT
52 become: True 85 become: True
53 86
54 - name: Make images 87 - name: Make images
diff --git a/tools/gate/playbooks/files/docker-systemd.conf b/tools/gate/playbooks/files/docker-systemd.conf
new file mode 100644
index 0000000..6b01af0
--- /dev/null
+++ b/tools/gate/playbooks/files/docker-systemd.conf
@@ -0,0 +1,8 @@
1# NOTE(SamYaple): CentOS cannot be build with userns-remap enabled. httpd uses
2# cap_set_file capability and there is no way to pass that in at build as of
3# docker 17.06.
4# TODO(SamYaple): Periodically check to see if this is possible in newer
5# versions of Docker
6[Service]
7ExecStart=
8ExecStart=/usr/bin/dockerd
diff --git a/tools/gate/playbooks/vars.yaml b/tools/gate/playbooks/vars.yaml
new file mode 100644
index 0000000..8da189a
--- /dev/null
+++ b/tools/gate/playbooks/vars.yaml
@@ -0,0 +1,20 @@
1# Copyright 2017 The Openstack-Helm Authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15docker_daemon:
16 group: zuul
17 registry-mirrors:
18 - "http://{{ zuul_site_mirror_fqdn }}:8082/"
19 storage-driver: overlay2
20 debug: True