Upload container images

This is an initial go at building this Python package and uploading
an image for it.  This will be followed up with some changes which
will make it easier to execute with an entrypoint and environment
variables later.

Change-Id: Ie2219fc96f32554bde1cac37faa0b961dc53b95e
This commit is contained in:
Mohammed Naser 2020-03-08 12:16:10 -04:00
parent 70d9a499d7
commit 54727daa85
7 changed files with 134 additions and 2 deletions

View File

@ -1,11 +1,71 @@
- secret:
name: lodgeit-opendev-dockerhub
data:
username: opendevzuul
password: !encrypted/pkcs1-oaep
- D6Z2bpBW0RSHMeqZP1PwjlJA8nLIac0BPKNMefelwHXeqD1w0pHTQ4W7MNvbmpmqxO0YG
vWOS5wxCuUJ37gELGfBRvWwvbnrfzhlh+nHqfZ2rh/8wYJuMV4HZOEnjJ5gHQSGldRW4g
+woxkkcJ/GzakyITAm/FhUiyMB6G3E6NLo8YDm/WTKsEtRmUtSbQMkGaZLfXY1QwCA9pN
7lYLr6Pibd2PQzCQWq1CAr4BJGdc10r/LWxyWC4EphF4RxsKLWNEktkT+ZfP2K9+tNtrL
/nkwdc9IUjSqWFa8JUQy0GREghpOW7GgMthoqvADgpdxOoqIhyC4gpFfciC2jXbsMC0pV
3kkCGQbv29LJ/gJ4QcqJHZ00OvI76XrE5CwQ7MFu+KIcTdoQtorIMOOx9ey/5UybJYlh9
nHnZP6UwMPQuxkbdJhlwhUnGKXaiJWGs97gHWVwcrThT/IEEKfFata2/Wn4dXlSr6u4t/
Xt34+eZOfqaGGdOjo/+U3IrxeMIM+KZl30/30vNBM95TxNxZ9JKR7XmOFwUWWxNc7LQng
soT47t74JaCpeUeX8otlpSKz9N+rFWkphrFai3qakKgqxpjyZ7k12veNhdrcqMLVrsOSI
EKTCnKphRQKSiMe0WjiaIvXNEGeIXMu6PlCIYvexzlrlUJJfc95Er+OlY7vvHg=
- job:
name: lodgeit-build-opendev-image
parent: opendev-build-docker-image
description: Build OpenDev Docker images for LodgeIt
requires:
- python-base-container-image
- python-builder-container-image
provides: lodgeit-container-image
vars: &lodgeit_opendev_image_vars
zuul_work_dir: src/opendev.org/opendev/lodgeit
docker_images:
- context: .
repository: opendevorg/lodgeit
target: lodgeit
- job:
name: lodgeit-upload-opendev-image
parent: opendev-upload-docker-image
description: Build OpenDev LodgeIt Docker images and upload to Docker Hub.
requires:
- python-base-container-image
- python-builder-container-image
provides: lodgeit-container-image
vars: *lodgeit_opendev_image_vars
secrets:
- name: docker_credentials
secret: lodgeit-opendev-dockerhub
pass-to-parent: true
- job:
name: lodgeit-promote-opendev-image
parent: opendev-promote-docker-image
description: Promote previously uploaded LodgeIt Docker images.
vars: *lodgeit_opendev_image_vars
secrets:
- name: docker_credentials
secret: lodgeit-opendev-dockerhub
pass-to-parent: true
- project:
check:
jobs:
- tox-pep8
- tox-py27
- tox-py36
- lodgeit-build-opendev-image
gate:
jobs:
- tox-pep8
- tox-py27
- tox-py36
- lodgeit-upload-opendev-image
promote:
jobs:
- lodgeit-promote-opendev-image

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
# Copyright (c) 2020 VEXXHOST, 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 lodgeit
COPY --from=builder /output/ /output
RUN /output/install-from-bindep
USER nobody
EXPOSE 9000
ENV LODGEIT_DBURI sqlite:////tmp/lodgeit.db
ENV LODGEIT_SECRET_KEY changeMe
CMD ["uwsgi", "--master", \
"--processes", "4", \
"--http-socket", "0.0.0.0:9000", \
"--wsgi-file", "/usr/local/bin/lodgeit-wsgi"]

1
bindep.txt Normal file
View File

@ -0,0 +1 @@
gcc [compile]

View File

@ -75,8 +75,14 @@ class LodgeIt(object):
self.cleanup_callbacks)
def make_app(dburi, secret_key, debug=False, shell=False):
def make_app(dburi=None, secret_key=None, debug=False, shell=False):
"""Apply the used middlewares and create the application."""
if dburi is None:
dburi = os.getenv('LODGEIT_DBURI')
if secret_key is None:
secret_key = os.getenv('LODGEIT_SECRET_KEY')
static_path = os.path.join(os.path.dirname(__file__), 'static')
app = LodgeIt(dburi, secret_key)
if debug:

View File

@ -2,9 +2,11 @@ six
Jinja2
Werkzeug<0.16
Pygments
SQLAlchemy==0.9.7
SQLAlchemy
PyMySQL
simplejson
Babel
pillow
pytz
MarkupSafe
uwsgi

12
setup.cfg Normal file
View File

@ -0,0 +1,12 @@
[metadata]
name = lodgeit
description-file =
README
license = BSD
summary = LodgeIt implements a pastebin
author = OpenDev
author-email = openstack-infra@lists.openstack.org
[entry_points]
wsgi_scripts =
lodgeit-wsgi = lodgeit.application:make_app

20
setup.py Normal file
View File

@ -0,0 +1,20 @@
# Copyright (c) 2020 VEXXHOST, 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.
import setuptools
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)