From d3b4cc974f6b961c655e7dc585e81b562870f4b8 Mon Sep 17 00:00:00 2001 From: Scott Hussey Date: Wed, 29 Nov 2017 16:03:46 -0600 Subject: [PATCH] Create simplestreams cache image - Create image with simplestreams package - Mirror current upstream maas.io xenial images - Run apache on port 8888 to serve the simplestreams repo Change-Id: I121d62894464ae62a2a59bd62a2448835a1f67af --- Makefile | 12 +++++++++++- images/sstream-cache/Dockerfile | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 images/sstream-cache/Dockerfile diff --git a/Makefile b/Makefile index 42ae366..8539a8e 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ REGION_SUFFIX ?= regiond REGION_IMG_DIR ?= images/maas-region-controller RACK_SUFFIX ?= rackd RACK_IMG_DIR ?= images/maas-rack-controller +CACHE_SUFFIX ?= cache +CACHE_IMG_DIR ?= images/sstream-cache IMAGE_PREFIX ?= attcomdev IMAGE_TAG ?= latest HELM ?= helm @@ -25,7 +27,7 @@ USE_PROXY ?= false # Build all docker images for this project .PHONY: images -images: build_rack build_region +images: build_rack build_region build_cache # Create tgz of the chart .PHONY: charts @@ -61,6 +63,14 @@ else docker build -t $(IMAGE_PREFIX)/$(MAAS_IMAGE_COMMON)-$(REGION_SUFFIX):$(IMAGE_TAG) -f $(REGION_IMG_DIR)/Dockerfile $(REGION_IMG_DIR) endif +.PHONY: build_cache +build_cache: +ifeq ($(USE_PROXY), true) + docker build -t $(IMAGE_PREFIX)/$(MAAS_IMAGE_COMMON)-$(CACHE_SUFFIX):$(IMAGE_TAG) -f $(CACHE_IMG_DIR)/Dockerfile $(CACHE_IMG_DIR) --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY) +else + docker build -t $(IMAGE_PREFIX)/$(MAAS_IMAGE_COMMON)-$(CACHE_SUFFIX):$(IMAGE_TAG) -f $(CACHE_IMG_DIR)/Dockerfile $(CACHE_IMG_DIR) +endif + .PHONY: clean clean: rm -rf build diff --git a/images/sstream-cache/Dockerfile b/images/sstream-cache/Dockerfile new file mode 100644 index 0000000..dbeba6e --- /dev/null +++ b/images/sstream-cache/Dockerfile @@ -0,0 +1,29 @@ +FROM ubuntu:16.04 + +ENV IMAGE_SRC https://images.maas.io/ephemeral-v3/daily/ + +RUN apt-get -qq update && \ + apt install -y simplestreams \ + apache2 \ + gpgv \ + ubuntu-cloudimage-keyring \ + python-certifi --no-install-recommends + +RUN sstream-mirror --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg $IMAGE_SRC \ + /var/www/html/maas/images/ephemeral-v3/daily 'arch=amd64' 'release~xenial' --max=1 --progress + +RUN sstream-mirror --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg $IMAGE_SRC \ + /var/www/html/maas/images/ephemeral-v3/daily 'os~(grub*|pxelinux)' --max=1 --progress + +RUN sh -c 'echo "" > /etc/apache2/ports.conf' + +ENV APACHE_RUN_USER www-data +ENV APACHE_RUN_GROUP www-data +ENV APACHE_PID_FILE /var/run/apache2.pid +ENV APACHE_RUN_DIR /var/run/ +ENV APACHE_LOCK_DIR /var/lock +ENV APACHE_LOG_DIR /var/log/ +ENV LANG C + +ENTRYPOINT ["/usr/sbin/apache2"] +CMD ["-E", "/dev/stderr","-c","ErrorLog /dev/stderr","-c","Listen 8888","-c","ServerRoot /etc/apache2","-c","DocumentRoot /var/www/html","-D","FOREGROUND"]