From 022c80a9a22dae64803cdc78cae5669f2f2d3588 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 10 Feb 2021 13:14:39 -0600 Subject: [PATCH] Use opendev base docker image and add jobs The other zuul containers use the python-builder/python-base pattern for the container images. Use that, and add a container build job Change-Id: I110d47995411323dcf4eaed2962c238ee67d62cf --- .zuul.yaml | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 15 ++++++------ bindep.txt | 3 +++ 3 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 bindep.txt diff --git a/.zuul.yaml b/.zuul.yaml index abd09f2..81f0a81 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,14 +1,86 @@ +- secret: + name: zuul-storage-proxy-dockerhub + data: + username: zuulzuul + password: !encrypted/pkcs1-oaep + - BkUxcXcPY0rzCPJfmwHcdILp9eSpi0m8JBR1LuFy+kzpeRUr+MQyaoMO8DigywiozoDg2 + s/dfYZWdDlGKc3+fIYT3XBh7nckUeijz6m249mzqWSv7i2/j9iG2F/iyL6zKVf1bI2nQB + aYUeo4RkXed5wYIJcHhmS8s6W6zEd077TrdLJJwD9BlftDwdBZcQGM+Y88AACxleywY/w + Uf+F3CKMr8BmjfPm0TPgq86bDMCizw6Hg8maWoTq6lV7c45juTTxXnEMjYwpB45h2ahwu + lv3ZhIHaWy7proiFPZ9q8QXHMPRZsCX2r/HO3pkCBagDcd2CQuNzLZhiQY/F6EJCgHetY + sLTP8j2FR17U7vrolJSCVrHG9AX6V3PCZfPN+tkHBRuxGwQeFweDJkBw4VBPU8U5tYTAH + AXunUw7uzKI7oyLoutK2RJ3Mdl+zBGtEeHiIbeFX/VCEylpHKSc237OR+jSO/qLihNeOi + NLxu7D7gtHR2G8pVDU5u9IV5a/nb2FDUQq9wC25IjDcRDbtx9jAYbihRdsEu0idjicJFZ + 0D/KJJ3teSPbX3t0EwYysgFihfja7R5/UA8gwJtyKaTUugZy7nX0LRY//8g9ZsWcyovaV + 0JayUGOpbz1AVtH30ieSmwF3uHy2elYtMQb4DvHqL7Ik8cSCeAhVoVNTRdxJyI= + +- job: + name: zuul-storage-proxy-build-image + description: Build and test a Docker image. + parent: opendev-build-docker-image + allowed-projects: zuul/zuul-storage-proxy + provides: zuul-storage-proxy-container-image + vars: &image_vars + docker_images: + - context: . + repository: zuul/zuul-storage-proxy + target: zuul-storage-proxy + tags: + # If zuul.tag is defined: [ '3', '3.19', '3.19.0' ]. Only works for 3-component tags. + # Otherwise: ['latest'] + &imagetag "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}" + +- job: + name: zuul-storage-proxy-upload-image + parent: opendev-upload-docker-image + description: Build and test a Docker image and upload to Docker Hub. + allowed-projects: zuul/zuul-storage-proxy + secrets: + name: docker_credentials + secret: zuul-storage-proxy-dockerhub + pass-to-parent: true + provides: zuul-storage-proxy-container-image + vars: *image_vars + +- job: + name: zuul-storage-proxy-promote-image + parent: opendev-promote-docker-image + description: Promote previously uploaded Docker image. + allowed-projects: zuul/zuul-storage-proxy + secrets: + name: docker_credentials + secret: zuul-storage-proxy-dockerhub + pass-to-parent: true + nodeset: + nodes: [] + vars: *image_vars + - project: + vars: + release_python: python3 check: jobs: + - zuul-storage-proxy-build-image - tox-linters: vars: tox_install_bindep: false gate: jobs: + - zuul-storage-proxy-upload-image - tox-linters: vars: tox_install_bindep: false + promote: + jobs: + - zuul-storage-proxy-promote-image release: jobs: - zuul-release-python + - upload-docker-image: + secrets: + name: docker_credentials + secret: zuul-storage-proxy-dockerhub + pass-to-parent: true + vars: + <<: *image_vars + upload_docker_image_promote: false diff --git a/Dockerfile b/Dockerfile index 7a689dc..c85e544 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ -FROM python:3.6-slim +FROM docker.io/opendevorg/python-builder as builder -RUN python -m venv /opt/swift-proxy +COPY . /tmp/src +RUN assemble -RUN mkdir -p /opt/swift-proxy-src +FROM docker.io/opendevorg/python-base as zuul-storage-proxy -COPY . /opt/swift-proxy-src/ - -RUN PBR_VERSION=1.0.0 /opt/swift-proxy/bin/pip install /opt/swift-proxy-src +COPY --from=builder /output/ /output +RUN /output/install-from-bindep EXPOSE 8000 - -CMD /opt/swift-proxy/bin/gunicorn -k eventlet -t 3600 --workers 10 swift_proxy:proxy +CMD ["/usr/local/bin/gunicorn", "-k", "eventlet", "-t", "3600", "--workers", "10", "swift_proxy:proxy"] diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 0000000..cb60a69 --- /dev/null +++ b/bindep.txt @@ -0,0 +1,3 @@ +gcc [compile test] +g++ [compile test platform:apk platform:dpkg] +gcc-c++ [compile test platform:rpm]