Create elastic-recheck container image

- part of replacing puppet deployment with ansible and docker-compose
- current change tests container building

Change-Id: Id70f156e63751ebd14908cc5da969e964f63645b
Story: TRIPLEOCI-177
This commit is contained in:
Sorin Sbarnea 2020-05-20 15:41:44 +01:00
parent 360c57118c
commit 88211997df
7 changed files with 98 additions and 9 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
.tox
.testrepository

View File

@ -7,11 +7,13 @@
- publish-tox-docs-infra
check:
jobs:
- elastic-recheck-container
- elastic-recheck-tox-queries:
voting: false
- openstack-tox-linters
gate:
jobs:
- elastic-recheck-container
- openstack-tox-linters
- job:
@ -23,3 +25,14 @@
Uses tox with the ``queries`` environment.
vars:
tox_envlist: queries
- job:
name: elastic-recheck-container
parent: opendev-build-docker-image
description: Build container images for elastic-recheck service
vars:
zuul_work_dir: src/opendev.org/opendev/elastic-recheck
docker_images:
- context: .
repository: opendevorg/elastic-recheck
target: elastic-recheck

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
# syntax=docker/dockerfile:experimental
FROM opendevorg/python-builder:3.7 as elastic-recheck-builder
COPY . /tmp/src
RUN assemble
FROM opendevorg/python-base:3.7 as elastic-recheck
COPY --from=elastic-recheck-builder /output/ /output
RUN /output/install-from-bindep && \
rm -rf /output
COPY data/ /data/
COPY queries/ /opt/elastic-recheck/queries
# using root allows us to use same relative paths in configs for running outside
# containers, where ./data contains persistent configs and logs.
WORKDIR /
CMD /usr/local/bin/elastic-recheck -f data/elastic-recheck.conf ${ER_OPTS:-}

47
Makefile Normal file
View File

@ -0,0 +1,47 @@
.EXPORT_ALL_VARIABLES:
PYTHON ?= $(shell command -v python3 python|head -n1)
# Keep docker before podman due to:
# https://github.com/containers/podman/issues/7602
ENGINE ?= $(shell command -v docker podman|head -n1)
# localhost/ prefix must be present in order to assure docker/podman compatibility:
# https://github.com/containers/buildah/issues/1034
IMAGE_TAG=localhost/elastic-recheck
# Enable newer docker buildkit if available
DOCKER_BUILDKIT=1
.PHONY: default
default: help
define PRINT_HELP_PYSCRIPT
import re, sys
print("Usage: make <target>\n")
cmds = {}
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
cmds.update({target: help})
for cmd in sorted(cmds):
print(f" {cmd:12} {cmds[cmd]}")
endef
export PRINT_HELP_PYSCRIPT
.PHONY: help
help:
@$(PYTHON) -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
.PHONY: build
build: ## Build image using docker
$(ENGINE) build -t $(IMAGE_TAG) .
@echo "Image size: $$(docker image inspect --format='scale=0; {{.Size}}/1024/1024' $(IMAGE_TAG) | bc)MB"
.PHONY: into
into: ## Starts bash inside docker image
$(ENGINE) run -it $(IMAGE_TAG) /bin/bash
.PHONY: dive
dive: ## Use `dive` tool to investigate container size
# https://github.com/wagoodman/dive
dive $(IMAGE_TAG)

View File

@ -237,6 +237,12 @@ Notes
generated files you will need to host a Kibana3 with that dashboard.
* View the OpenStack ElasticSearch `cluster health here`_.
Development
-----------
In addition to using ``tox`` you can also run ``make`` in order
to list current container build and testing commands.
Future Work
-----------

View File

@ -1,15 +1,18 @@
# This is a cross-platform list tracking distribution packages needed by tests;
# see http://docs.openstack.org/infra/bindep/ for additional information.
dbus-devel [platform:rpm]
dbus-glib-devel [platform:rpm]
dbus-devel [platform:rpm test compile]
dbus-glib-devel [platform:rpm test compile]
build-essential [test compile]
gcc [test compile]
g++ [test compile]
language-pack-en [platform:ubuntu]
libffi-dev [platform:dpkg]
libffi-devel [platform:rpm]
libffi-dev [platform:dpkg test compile]
libffi-devel [platform:rpm test compile]
# e-r->launchpadlib->keyring->secretstorage->cryptography->ssl
libssl-dev [platform:dpkg]
openssl-devel [platform:rpm !platform:suse]
libopenssl-devel [platform:suse !platform:rpm]
libssl-dev [platform:dpkg test compile]
openssl-devel [platform:rpm !platform:suse test compile]
libopenssl-devel [platform:suse !platform:rpm test compile]
locales [platform:debian]
python3-dev [platform:dpkg]
python3-devel [platform:rpm]
python3-dev [platform:dpkg test compile]
python3-devel [platform:rpm test compile]

0
data/.gitignore vendored Normal file
View File