From f274c0f6bfd35ae562a158746b9457d3571978c9 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 24 Jan 2019 08:02:04 -0800 Subject: [PATCH] Build images with Dockerfile instead of pbrx Use the opendevorg/python-builder image to build nodepool images with a Dockerfile and multi-stage builds. bindep wasn't installing gcc for dpkg. Remove the platform restrictions for it. Change-Id: I0282b75ffad3d0ae1b589381010a3d4273fceb07 --- .dockerignore | 3 +++ .zuul.yaml | 70 +++++++++++++++++++++++++++++++++++++++++++-------- Dockerfile | 33 ++++++++++++++++++++++++ bindep.txt | 2 +- 4 files changed, 97 insertions(+), 11 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..aff58c274 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.mypy_cache +.stestr +.tox diff --git a/.zuul.yaml b/.zuul.yaml index efd99e20d..d060d591c 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -155,6 +155,61 @@ required-projects: - openstack-infra/nodepool +- secret: + name: nodepool-dockerhub + data: + username: zuulzuul + password: !encrypted/pkcs1-oaep + - VV5m4XbsYvAz0/7T+WoIypvD3ijRsPYrGo4O5JuOHt6TX14s9B1KddeMwnabEEKapPdbb + cwqbzFKoHRMi8DdXiDKxrgbTSC1jb3BvKq7XE0/xF4Bq2dM+r3yDnXS6a7BuijSqFSiMG + /9bf0jqEAWXWCvbYUAxKOklJIRLjcKywCP5CulmW6EV8f1Iya8Y7UGpjGyL34FVQuc52Y + 5MLp+Dra95pvBJMgikbu7LtMPCXOMctUFBpwNArCjWKGhz00UZwyAmsbPPHwQWb+884ZP + v9zi2FuRAL+rn4DRVwyIw28ZdCEr5F5EkZon3lSIhikhdQIyHPtW8VwMJTL4RxBdmgcEt + +zZBbLlOU+0AHPGLlO/yQNvHeSzwY9pe2oIGuqSu3h6zp6Y0NIE/Q0VpiIXWpOAnLOmno + uOd3j9tZ1beol2mg4Yk7rOaXu1Fvtfhd1K3LpLzEbiGzCMIEZuFHU2ZInAbUmtm0BtbDa + /bYvI9dB/uqA2xgse5rVMa++v3AfWJTJhFY/wBU4fHOWlFBUZKFuSoijUcWMfnfMMyU2B + A5CQKhv4Wmtzbvo/oneYkwFOTYaPNj2DS0BcFJFkR8FZDYmTBPnKoBH5wpwwnrzPOpCMa + L21z+Vp1Vce1XCsaOduMrmZDvuQcK1YOKIIUeElAQw8GuwTfcXqekoPvp54SeE= + +- job: + name: nodepool-build-image + parent: build-docker-image + description: Build Docker images. + vars: &nodepool_image_vars + docker_images: + - context: . + repository: zuul/nodepool-base + target: nodepool-base + - context: . + repository: zuul/nodepool + target: nodepool + - context: . + repository: zuul/nodepool-launcher + target: nodepool-launcher + - context: . + repository: zuul/nodepool-builder + target: nodepool-builder + +- job: + name: nodepool-upload-image + parent: upload-docker-image + description: Build Docker images and upload to Docker Hub. + vars: *nodepool_image_vars + secrets: + - name: docker_credentials + secret: nodepool-dockerhub + pass-to-parent: true + +- job: + name: nodepool-promote-image + parent: promote-docker-image + description: Promote previously uploaded Docker images. + vars: *nodepool_image_vars + secrets: + - name: docker_credentials + secret: nodepool-dockerhub + pass-to-parent: true + - project: check: jobs: @@ -171,9 +226,7 @@ voting: false - nodepool-functional-k8s - nodepool-functional-openshift - - pbrx-build-container-images: - vars: - pbrx_prefix: zuul + - nodepool-build-image - zuul-quick-start gate: jobs: @@ -182,17 +235,14 @@ - tox-py35 - tox-py36: nodeset: ubuntu-bionic - - pbrx-build-container-images: - vars: - pbrx_prefix: zuul - zuul-quick-start + - nodepool-upload-image post: jobs: - publish-zuul-docs - - openstackzuul-pbrx-push-container-images: - vars: - pbrx_prefix: zuul - + promote: + jobs: + - nodepool-promote-image experimental: jobs: - nodepool-functional-py35-debian-src diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..f6d6bf290 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Copyright (c) 2019 Red Hat, Inc. +# +# 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. + +FROM opendevorg/python-builder as builder + +COPY . /tmp/src +RUN assemble + +FROM opendevorg/python-base as nodepool-base + +COPY --from=builder /output/ /output +RUN /output/install-from-bindep + +FROM nodepool-base as nodepool +CMD ["/usr/local/bin/nodepool"] + +FROM nodepool-base as nodepool-launcher +CMD ["/usr/local/bin/nodepool-launcher"] + +FROM nodepool-base as nodepool-builder +CMD ["/usr/local/bin/nodepool-builder"] diff --git a/bindep.txt b/bindep.txt index 510b026ce..c87ac3911 100644 --- a/bindep.txt +++ b/bindep.txt @@ -1,7 +1,7 @@ # This is a cross-platform list tracking distribution packages needed by tests; # see http://docs.openstack.org/infra/bindep/ for additional information. -gcc [compile test platform:rpm platform:apk] +gcc [compile test] libffi-devel [platform:rpm] libffi-dev [platform:dpkg] libffi-dev [compile test platform:apk]