Ironic and dependency images
* Add script and dockerfile to build ironic image using loci image build * Add dockerfile for apache and dnsmasq * Add make files and readme for all images Change-Id: Ia37b4608116b5705512faec1d966b45e413a1760 Signed-off-by: Sreejith Punnapuzha <sreejith.punnapuzha@outlook.com>
This commit is contained in:
parent
aa624ce27c
commit
b7bcc0924d
18
apache/Dockerfile
Normal file
18
apache/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode' \
|
||||||
|
org.opencontainers.image.url='https://airshipit.org' \
|
||||||
|
org.opencontainers.image.documentation='https://airship-images.readthedocs.org' \
|
||||||
|
org.opencontainers.image.source='https://opendev.org/airship/images' \
|
||||||
|
org.opencontainers.image.vendor='The Airship Authors' \
|
||||||
|
org.opencontainers.image.licenses='Apache-2.0'
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get update -qq && apt-get -y dist-upgrade \
|
||||||
|
&& apt-get install -y apache2 \
|
||||||
|
&& apt-get autoremove -y --purge \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt-get/lists/*
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
109
apache/Makefile
Normal file
109
apache/Makefile
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
BUILD_DIR ?= build
|
||||||
|
PUSH_IMAGE ?= false
|
||||||
|
IMAGE_ID ?= none
|
||||||
|
COMMIT ?= $(shell git rev-parse HEAD)
|
||||||
|
LABEL ?= org.airshipit.build=community
|
||||||
|
IMAGE_NAME ?= apache
|
||||||
|
DOCKER_REGISTRY ?= quay.io
|
||||||
|
IMAGE_PREFIX ?= airshipit
|
||||||
|
IMAGE_TAG ?= latest
|
||||||
|
DISTRO ?= ubuntu_bionic
|
||||||
|
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}
|
||||||
|
SH_TO_CHECK := $(wildcard files/*.sh )
|
||||||
|
PROXY ?= http://proxy.foo.com:8000
|
||||||
|
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||||
|
USE_PROXY ?= false
|
||||||
|
|
||||||
|
all: lint images
|
||||||
|
|
||||||
|
check-docker:
|
||||||
|
@if [ -z $$(which docker) ]; then \
|
||||||
|
echo "Missing \`docker\` client which is required for development"; \
|
||||||
|
exit 2; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
images: check-docker build_image
|
||||||
|
|
||||||
|
docs: clean build_docs
|
||||||
|
|
||||||
|
build_docs:
|
||||||
|
echo TODO
|
||||||
|
|
||||||
|
build_image:
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
ifeq ($(IMAGE_ID), none)
|
||||||
|
ifeq ($(USE_PROXY), true)
|
||||||
|
docker build . \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg http_proxy=$(PROXY) \
|
||||||
|
--build-arg https_proxy=$(PROXY) \
|
||||||
|
--build-arg HTTP_PROXY=$(PROXY) \
|
||||||
|
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||||
|
--build-arg no_proxy=$(NO_PROXY) \
|
||||||
|
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT)
|
||||||
|
else
|
||||||
|
docker build . \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
echo $(IMAGE_ID) > $(BUILD_DIR)/image_id
|
||||||
|
endif
|
||||||
|
ifeq ($(PUSH_IMAGE), true)
|
||||||
|
docker push $(IMAGE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
ifeq ($(IMAGE_ID), none)
|
||||||
|
if [[ -s $(BUILD_DIR)/image_id ]]; \
|
||||||
|
then \
|
||||||
|
docker rmi $$(cat $(BUILD_DIR)/image_id); \
|
||||||
|
fi
|
||||||
|
endif
|
||||||
|
rm -rf $(BUILD_DIR)
|
||||||
|
|
||||||
|
# style checks
|
||||||
|
lint: test-shellcheck
|
||||||
|
echo "TODO"
|
||||||
|
|
||||||
|
tests: lint unit_tests
|
||||||
|
|
||||||
|
test-shellcheck: $(SH_TO_CHECK)
|
||||||
|
|
||||||
|
unit_tests:
|
||||||
|
echo TODO
|
||||||
|
|
||||||
|
$(SH_TO_CHECK):
|
||||||
|
docker run --rm -v $(shell pwd):/mnt \
|
||||||
|
nlknguyen/alpine-shellcheck -x /mnt/$(@)
|
||||||
|
|
||||||
|
.PHONY: test clean $(SH_TO_CHECK) test-shellcheck tests lint build_image \
|
||||||
|
all build_docs docs check-docker images
|
3
apache/README.md
Normal file
3
apache/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# apache-image
|
||||||
|
|
||||||
|
This image serves apache/httpd image that is used by metal3 to setup ironic.
|
49
dnsmasq/Dockerfile
Normal file
49
dnsmasq/Dockerfile
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
ARG FROM=docker.io/ubuntu:bionic
|
||||||
|
FROM ${FROM} AS builder
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update && apt-get install -y efibootmgr gcc git make genisoimage xz-utils grub2-common grub-efi-amd64 grub-efi-amd64-bin shim shim-signed dosfstools mtools liblzma-dev
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN git clone http://git.ipxe.org/ipxe.git && \
|
||||||
|
cd ipxe && \
|
||||||
|
git checkout 3fe683ebab29afacf224e6b0921f6329bebcdca7 && \
|
||||||
|
cd src && \
|
||||||
|
sed -i -e "s/#undef.*NET_PROTO_IPV6/#define NET_PROTO_IPV6/g" config/general.h && \
|
||||||
|
make bin/undionly.kpxe bin-x86_64-efi/ipxe.efi bin-x86_64-efi/snponly.efi
|
||||||
|
|
||||||
|
RUN if [ $(uname -m) = "x86_64" ]; then \
|
||||||
|
dd bs=1024 count=3200 if=/dev/zero of=esp.img && \
|
||||||
|
mkfs.msdos -F 12 -n 'ESP_IMAGE' ./esp.img && \
|
||||||
|
mmd -i esp.img EFI && \
|
||||||
|
mmd -i esp.img EFI/BOOT && \
|
||||||
|
mkdir -p /boot/efi && \
|
||||||
|
grub-mkimage -C xz -O x86_64-efi -p /boot/grub -o /tmp/grubx64.efi boot linux search normal configfile part_gpt btrfs ext2 fat iso9660 loopback test keystatus gfxmenu regexp probe efi_gop efi_uga all_video gfxterm font scsi echo read ls cat png jpeg halt reboot && \
|
||||||
|
mcopy -i esp.img -v /tmp/grubx64.efi ::EFI/BOOT && \
|
||||||
|
mdir -i esp.img ::EFI/BOOT; \
|
||||||
|
else \
|
||||||
|
touch /tmp/esp.img; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
FROM ${FROM}
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode' \
|
||||||
|
org.opencontainers.image.url='https://airshipit.org' \
|
||||||
|
org.opencontainers.image.documentation='https://airship-images.readthedocs.org' \
|
||||||
|
org.opencontainers.image.source='https://opendev.org/airship/images' \
|
||||||
|
org.opencontainers.image.vendor='The Airship Authors' \
|
||||||
|
org.opencontainers.image.licenses='Apache-2.0'
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get update -qq && apt-get -y dist-upgrade \
|
||||||
|
&& apt-get install -y dnsmasq \
|
||||||
|
&& apt-get autoremove -y --purge \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt-get/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /tftpboot
|
||||||
|
COPY --from=builder /tmp/ipxe/src/bin/undionly.kpxe /tftpboot
|
||||||
|
COPY --from=builder /tmp/ipxe/src/bin-x86_64-efi/snponly.efi /tftpboot
|
||||||
|
COPY --from=builder /tmp/ipxe/src/bin-x86_64-efi/ipxe.efi /tftpboot
|
||||||
|
COPY --from=builder /tmp/esp.img /tmp/uefi_esp.img
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
109
dnsmasq/Makefile
Normal file
109
dnsmasq/Makefile
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
BUILD_DIR ?= build
|
||||||
|
PUSH_IMAGE ?= false
|
||||||
|
IMAGE_ID ?= none
|
||||||
|
COMMIT ?= $(shell git rev-parse HEAD)
|
||||||
|
LABEL ?= org.airshipit.build=community
|
||||||
|
IMAGE_NAME ?= dnsmasq
|
||||||
|
DOCKER_REGISTRY ?= quay.io
|
||||||
|
IMAGE_PREFIX ?= airshipit
|
||||||
|
IMAGE_TAG ?= latest
|
||||||
|
DISTRO ?= ubuntu_bionic
|
||||||
|
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}
|
||||||
|
SH_TO_CHECK := $(wildcard files/*.sh )
|
||||||
|
PROXY ?= http://proxy.foo.com:8000
|
||||||
|
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||||
|
USE_PROXY ?= false
|
||||||
|
|
||||||
|
all: lint images
|
||||||
|
|
||||||
|
check-docker:
|
||||||
|
@if [ -z $$(which docker) ]; then \
|
||||||
|
echo "Missing \`docker\` client which is required for development"; \
|
||||||
|
exit 2; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
images: check-docker build_image
|
||||||
|
|
||||||
|
docs: clean build_docs
|
||||||
|
|
||||||
|
build_docs:
|
||||||
|
echo TODO
|
||||||
|
|
||||||
|
build_image:
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
ifeq ($(IMAGE_ID), none)
|
||||||
|
ifeq ($(USE_PROXY), true)
|
||||||
|
docker build . \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg http_proxy=$(PROXY) \
|
||||||
|
--build-arg https_proxy=$(PROXY) \
|
||||||
|
--build-arg HTTP_PROXY=$(PROXY) \
|
||||||
|
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||||
|
--build-arg no_proxy=$(NO_PROXY) \
|
||||||
|
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT)
|
||||||
|
else
|
||||||
|
docker build . \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
echo $(IMAGE_ID) > $(BUILD_DIR)/image_id
|
||||||
|
endif
|
||||||
|
ifeq ($(PUSH_IMAGE), true)
|
||||||
|
docker push $(IMAGE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
ifeq ($(IMAGE_ID), none)
|
||||||
|
if [[ -s $(BUILD_DIR)/image_id ]]; \
|
||||||
|
then \
|
||||||
|
docker rmi $$(cat $(BUILD_DIR)/image_id); \
|
||||||
|
fi
|
||||||
|
endif
|
||||||
|
rm -rf $(BUILD_DIR)
|
||||||
|
|
||||||
|
# style checks
|
||||||
|
lint: test-shellcheck
|
||||||
|
echo "TODO"
|
||||||
|
|
||||||
|
tests: lint unit_tests
|
||||||
|
|
||||||
|
test-shellcheck: $(SH_TO_CHECK)
|
||||||
|
|
||||||
|
unit_tests:
|
||||||
|
echo TODO
|
||||||
|
|
||||||
|
$(SH_TO_CHECK):
|
||||||
|
docker run --rm -v $(shell pwd):/mnt \
|
||||||
|
nlknguyen/alpine-shellcheck -x /mnt/$(@)
|
||||||
|
|
||||||
|
.PHONY: test clean $(SH_TO_CHECK) test-shellcheck tests lint build_image \
|
||||||
|
all build_docs docs check-docker images
|
3
dnsmasq/README.md
Normal file
3
dnsmasq/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# dnsmasq-image
|
||||||
|
|
||||||
|
This image serves dnsmasq image that is used by metal3 to setup ironic.
|
222
ironic/Makefile
Normal file
222
ironic/Makefile
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
BUILD_DIR ?= build
|
||||||
|
PUSH_IMAGE ?= false
|
||||||
|
IMAGE_ID ?= none
|
||||||
|
COMMIT ?= $(shell git rev-parse HEAD)
|
||||||
|
LABEL ?= org.airshipit.build=community
|
||||||
|
DOCKER_REGISTRY ?= quay.io
|
||||||
|
IMAGE_PREFIX ?= airshipit
|
||||||
|
OPENSTACK_VERSION ?= stable/ussuri
|
||||||
|
DISTRO ?= ubuntu_bionic
|
||||||
|
OS_VER = $(word 2, $(subst /, ,$(OPENSTACK_VERSION)))
|
||||||
|
IMAGE_TAG ?= ${OS_VER}-${DISTRO}
|
||||||
|
IMAGE_IRONIC := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/ironic:${IMAGE_TAG}-${DISTRO}
|
||||||
|
IMAGE_REQUIREMENTS := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/requirements:${IMAGE_TAG}-${DISTRO}
|
||||||
|
IMAGE_LOCI_WHEELS := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/loci_wheels:${IMAGE_TAG}-${DISTRO}
|
||||||
|
SH_TO_CHECK := $(wildcard files/*.sh )
|
||||||
|
PROXY ?= http://proxy.foo.com:8000
|
||||||
|
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||||
|
USE_PROXY ?= false
|
||||||
|
BASE_IMAGE ?= docker.io/ubuntu:bionic
|
||||||
|
ironic_profiles ?= "fluent ipxe ipmi qemu tftp"
|
||||||
|
ironic_pip_packages ?= "pycrypto python-openstackclient"
|
||||||
|
ironic_dist_packages ?= "ethtool lshw iproute2"
|
||||||
|
|
||||||
|
all: lint images
|
||||||
|
|
||||||
|
check-docker:
|
||||||
|
@if [ -z $$(which docker) ]; then \
|
||||||
|
echo "Missing \`docker\` client which is required for development"; \
|
||||||
|
exit 2; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
images: check-docker build_requirements build_loci_wheels run_wheel_srvr build_ironic
|
||||||
|
|
||||||
|
docs: clean build_docs
|
||||||
|
|
||||||
|
build_docs:
|
||||||
|
echo TODO
|
||||||
|
|
||||||
|
build_requirements:
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
ifeq ($(IMAGE_ID), none)
|
||||||
|
ifeq ($(USE_PROXY), true)
|
||||||
|
docker build --force-rm --pull --no-cache \
|
||||||
|
https://git.openstack.org/openstack/loci.git \
|
||||||
|
--network host \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE_REQUIREMENTS) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg PYTHON3=yes \
|
||||||
|
--build-arg FROM=${BASE_IMAGE} \
|
||||||
|
--build-arg PROJECT=requirements \
|
||||||
|
--build-arg PROJECT_REF=${OPENSTACK_VERSION} \
|
||||||
|
--build-arg http_proxy=$(PROXY) \
|
||||||
|
--build-arg https_proxy=$(PROXY) \
|
||||||
|
--build-arg HTTP_PROXY=$(PROXY) \
|
||||||
|
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||||
|
--build-arg no_proxy=$(NO_PROXY) \
|
||||||
|
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT)
|
||||||
|
else
|
||||||
|
docker build --force-rm --pull --no-cache \
|
||||||
|
https://git.openstack.org/openstack/loci.git \
|
||||||
|
--network host \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE_REQUIREMENTS) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg PYTHON3=yes \
|
||||||
|
--build-arg FROM=${BASE_IMAGE} \
|
||||||
|
--build-arg PROJECT=requirements \
|
||||||
|
--build-arg PROJECT_REF=${OPENSTACK_VERSION} \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
echo $(IMAGE_ID) > $(BUILD_DIR)/image_id
|
||||||
|
endif
|
||||||
|
|
||||||
|
build_loci_wheels:
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
ifeq ($(IMAGE_ID), none)
|
||||||
|
ifeq ($(USE_PROXY), true)
|
||||||
|
docker build --force-rm --no-cache \
|
||||||
|
-f dockerfiles/ubuntu_Dockerfile \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE_LOCI_WHEELS) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg "IMAGE=${IMAGE_REQUIREMENTS}" \
|
||||||
|
--build-arg http_proxy=$(PROXY) \
|
||||||
|
--build-arg https_proxy=$(PROXY) \
|
||||||
|
--build-arg HTTP_PROXY=$(PROXY) \
|
||||||
|
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||||
|
--build-arg no_proxy=$(NO_PROXY) \
|
||||||
|
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT) dockerfiles/
|
||||||
|
else
|
||||||
|
docker build --force-rm --no-cache \
|
||||||
|
-f dockerfiles/ubuntu_Dockerfile \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE_LOCI_WHEELS) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg "IMAGE=${IMAGE_REQUIREMENTS}" \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT) dockerfiles/
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
echo $(IMAGE_ID) > $(BUILD_DIR)/image_id
|
||||||
|
endif
|
||||||
|
|
||||||
|
run_wheel_srvr:
|
||||||
|
docker run -d -p 0.0.0.0:8080:80 $(IMAGE_LOCI_WHEELS)
|
||||||
|
|
||||||
|
build_ironic:
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
ifeq ($(IMAGE_ID), none)
|
||||||
|
ifeq ($(USE_PROXY), true)
|
||||||
|
docker build --force-rm --pull --no-cache \
|
||||||
|
https://git.openstack.org/openstack/loci.git \
|
||||||
|
--network host \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE_IRONIC) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg PYTHON3=yes \
|
||||||
|
--build-arg FROM=${BASE_IMAGE} \
|
||||||
|
--build-arg PROJECT=ironic \
|
||||||
|
--build-arg PROJECT_REF=${OPENSTACK_VERSION} \
|
||||||
|
--build-arg WHEELS=http://172.17.0.1:8080/wheels.tar.gz \
|
||||||
|
--build-arg PROFILES=${ironic_profiles} \
|
||||||
|
--build-arg PIP_PACKAGES=${ironic_pip_packages} \
|
||||||
|
--build-arg DIST_PACKAGES=${ironic_dist_packages} \
|
||||||
|
--build-arg http_proxy=$(PROXY) \
|
||||||
|
--build-arg https_proxy=$(PROXY) \
|
||||||
|
--build-arg HTTP_PROXY=$(PROXY) \
|
||||||
|
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||||
|
--build-arg no_proxy=$(NO_PROXY) \
|
||||||
|
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT)
|
||||||
|
else
|
||||||
|
docker build --force-rm --pull --no-cache \
|
||||||
|
https://git.openstack.org/openstack/loci.git \
|
||||||
|
--network host \
|
||||||
|
--iidfile $(BUILD_DIR)/image_id \
|
||||||
|
--tag $(IMAGE_IRONIC) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
|
--label "org.opencontainers.image.created=\
|
||||||
|
$(shell date --rfc-3339=seconds --utc)" \
|
||||||
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
|
--build-arg PYTHON3=yes \
|
||||||
|
--build-arg FROM=${BASE_IMAGE} \
|
||||||
|
--build-arg PROJECT=ironic \
|
||||||
|
--build-arg PROJECT_REF=${OPENSTACK_VERSION} \
|
||||||
|
--build-arg WHEELS=http://172.17.0.1:8080/wheels.tar.gz \
|
||||||
|
--build-arg PROFILES=${ironic_profiles} \
|
||||||
|
--build-arg PIP_PACKAGES=${ironic_pip_packages} \
|
||||||
|
--build-arg DIST_PACKAGES=${ironic_dist_packages} \
|
||||||
|
--build-arg GIT_COMMIT=$(COMMIT)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
echo $(IMAGE_ID) > $(BUILD_DIR)/image_id
|
||||||
|
endif
|
||||||
|
ifeq ($(PUSH_IMAGE), true)
|
||||||
|
docker push $(IMAGE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
ifeq ($(IMAGE_ID), none)
|
||||||
|
if [[ -s $(BUILD_DIR)/image_id ]]; \
|
||||||
|
then \
|
||||||
|
docker rmi $$(cat $(BUILD_DIR)/image_id); \
|
||||||
|
fi
|
||||||
|
endif
|
||||||
|
rm -rf $(BUILD_DIR)
|
||||||
|
|
||||||
|
# style checks
|
||||||
|
lint: test-shellcheck
|
||||||
|
|
||||||
|
tests: lint unit_tests
|
||||||
|
|
||||||
|
test-shellcheck: $(SH_TO_CHECK)
|
||||||
|
|
||||||
|
unit_tests:
|
||||||
|
echo TODO
|
||||||
|
|
||||||
|
$(SH_TO_CHECK):
|
||||||
|
docker run --rm -v $(shell pwd):/mnt \
|
||||||
|
nlknguyen/alpine-shellcheck -x /mnt/$(@)
|
||||||
|
|
||||||
|
.PHONY: test clean $(SH_TO_CHECK) test-shellcheck tests lint build_requirements \
|
||||||
|
build_loci_wheels run_wheel_srvr build_ironic all build_docs docs check-docker images
|
6
ironic/README.md
Normal file
6
ironic/README.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# ironic-image
|
||||||
|
|
||||||
|
[ironic](https://docs.openstack.org/ironic/latest/) serving image.
|
||||||
|
|
||||||
|
This serves the ironic image that is used by metal3.
|
||||||
|
To build the image run build.sh with necessary environment variables.
|
57
ironic/build-image.sh
Executable file
57
ironic/build-image.sh
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Default script behavior
|
||||||
|
#
|
||||||
|
# BASE_IMAGE represents LOCI's "base" image name.
|
||||||
|
# Use ubuntu|leap15|centos|debian to build base image from LOCI's Dockerfiles.
|
||||||
|
: "${BASE_IMAGE:="docker.io/ubuntu:bionic"}"
|
||||||
|
# Replace with Registry URI with your registry like your
|
||||||
|
# dockerhub user. Example: "docker.io/openstackhelm"
|
||||||
|
: "${REGISTRY_URI:="quay.io/airshipit"}"
|
||||||
|
# The openstack branch to build, if no per project branch is given.
|
||||||
|
: "${OPENSTACK_VERSION:=stable/ussuri}"
|
||||||
|
# Sepcify OS distribution
|
||||||
|
: "${DISTRO:="ubuntu_bionic"}"
|
||||||
|
# extra build arguments for the base image. See loci's dockerfiles for
|
||||||
|
# arguments that could be used for example.
|
||||||
|
: "${base_extra_build_args:="--force-rm --pull --no-cache"}"
|
||||||
|
# Defaults for projects
|
||||||
|
: "${ironic_profiles:="'fluent ipxe ipmi qemu tftp'"}"
|
||||||
|
: "${ironic_pip_packages:="pycrypto python-openstackclient"}"
|
||||||
|
: "${ironic_dist_packages:="ethtool lshw iproute2"}"
|
||||||
|
# Image tag
|
||||||
|
IMAGE_TAG="${OPENSTACK_VERSION#*/}-${DISTRO}"
|
||||||
|
|
||||||
|
echo "Build Pre-Requirement docker image"
|
||||||
|
docker build ${base_extra_build_args} \
|
||||||
|
https://git.openstack.org/openstack/loci.git \
|
||||||
|
--network host \
|
||||||
|
--build-arg PYTHON3=yes \
|
||||||
|
--build-arg FROM=${BASE_IMAGE} \
|
||||||
|
--build-arg PROJECT=requirements \
|
||||||
|
--build-arg PROJECT_REF=${OPENSTACK_VERSION} \
|
||||||
|
--tag ${REGISTRY_URI}/requirements:${IMAGE_TAG}
|
||||||
|
|
||||||
|
echo "Build Container with wheel packages"
|
||||||
|
docker build --force-rm --no-cache \
|
||||||
|
-f dockerfiles/ubuntu_Dockerfile \
|
||||||
|
--build-arg "IMAGE=${REGISTRY_URI}/requirements:${IMAGE_TAG}" \
|
||||||
|
--tag ${REGISTRY_URI}/loci_wheels:latest dockerfiles/
|
||||||
|
|
||||||
|
echo "Host wheel packages in web server"
|
||||||
|
docker run -d -p 0.0.0.0:8080:80 ${REGISTRY_URI}/loci_wheels:latest
|
||||||
|
|
||||||
|
echo "Build ironic image"
|
||||||
|
docker build ${base_extra_build_args} \
|
||||||
|
https://git.openstack.org/openstack/loci.git \
|
||||||
|
--network host \
|
||||||
|
--build-arg PYTHON3=yes \
|
||||||
|
--build-arg FROM=${BASE_IMAGE} \
|
||||||
|
--build-arg PROJECT=ironic \
|
||||||
|
--build-arg PROJECT_REF=${OPENSTACK_VERSION} \
|
||||||
|
--build-arg WHEELS=http://172.17.0.1:8080/wheels.tar.gz \
|
||||||
|
--build-arg PROFILES="${ironic_profiles}" \
|
||||||
|
--build-arg PIP_PACKAGES="${ironic_pip_packages}" \
|
||||||
|
--build-arg DIST_PACKAGES="${ironic_dist_packages}" \
|
||||||
|
--tag ${REGISTRY_URI}/ironic:${IMAGE_TAG}
|
9
ironic/dockerfiles/ubuntu_Dockerfile
Normal file
9
ironic/dockerfiles/ubuntu_Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Set default image for requirements image
|
||||||
|
ARG IMAGE=""
|
||||||
|
FROM $IMAGE as requirements
|
||||||
|
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Previously built requirements image
|
||||||
|
COPY --from=requirements / /usr/share/nginx/html
|
||||||
|
RUN cd /usr/share/nginx/html; tar c -f wheels.tar.gz -z *.whl *.txt; rm -f *.whl
|
Loading…
Reference in New Issue
Block a user