container images: fixes and update to f33

- Install which (because it's sometimes not installed by default)
- Fedora 33 images are out now, build and publish them
- Remove PyYAML workaround that is no longer necessary

Fixes: https://github.com/ansible-community/ara/issues/192
Change-Id: Ia64455655cd37299d84c657a3dc87e079f92f790
This commit is contained in:
David Moreau Simard 2020-12-04 18:41:11 -05:00
parent 1b848c7c36
commit e1d470f289
No known key found for this signature in database
GPG Key ID: 7D4729EC4E64E8B7
7 changed files with 28 additions and 31 deletions

View File

@ -27,14 +27,14 @@ You will need to install `buildah <https://github.com/containers/buildah/blob/ma
The different scripts to build container images are available in the git repository:
- fedora32-distribution.sh_: Builds an image from Fedora 32 `distribution packages <https://koji.fedoraproject.org/koji/packageinfo?packageID=24394>`_
- fedora32-pypi.sh_: Builds an image from `PyPi <https://pypi.org/project/ara>`_ packages on Fedora 32
- fedora32-source.sh_: Builds an image from `git source <https://github.com/ansible-community/ara>`_ on Fedora 32
- fedora33-distribution.sh_: Builds an image from Fedora 33`distribution packages <https://koji.fedoraproject.org/koji/packageinfo?packageID=24394>`_
- fedora33-pypi.sh_: Builds an image from `PyPi <https://pypi.org/project/ara>`_ packages on Fedora 33
- fedora33-source.sh_: Builds an image from `git source <https://github.com/ansible-community/ara>`_ on Fedora 33
- centos8-pypi.sh_: Builds an image from `PyPi <https://pypi.org/project/ara>`_ packages on CentOS 8
.. _fedora32-distribution.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora32-distribution.sh
.. _fedora32-pypi.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora32-pypi.sh
.. _fedora32-source.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora32-source.sh
.. _fedora33-distribution.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora33-distribution.sh
.. _fedora33-pypi.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora33-pypi.sh
.. _fedora33-source.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/fedora33-source.sh
.. _centos8-pypi.sh: https://github.com/ansible-community/ara/blob/master/contrib/container-images/centos8-pypi.sh
The scripts have no arguments other than the ability to specify an optional name
@ -44,7 +44,7 @@ and tag:
$ git clone https://github.com/ansible-community/ara
$ cd ara/contrib/container-images
$ ./fedora32-source.sh ara-api:latest
$ ./fedora33-source.sh ara-api:latest
# [...]
Getting image source signatures
Copying blob 59bbb69efd73 skipped: already exists

View File

@ -6,7 +6,7 @@ build=$(buildah from centos:8)
# This lets users swap easily from the sqlite default to mysql or postgresql just by tweaking settings.yaml.
# Note: We use the packaged versions of psycopg2 and mysql python libraries so
# we don't need to install development libraries before installing them from PyPi.
buildah run "${build}" -- /bin/bash -c "dnf update -y && dnf install -y epel-release && dnf install -y python3-pip python3-gunicorn python3-psycopg2 python3-mysql && dnf clean all"
buildah run "${build}" -- /bin/bash -c "dnf update -y && dnf install -y epel-release && dnf install -y which python3-pip python3-gunicorn python3-psycopg2 python3-mysql && dnf clean all"
# Install ara from source with API server extras for dependencies (django & django-rest-framework)
buildah run "${build}" -- /bin/bash -c "pip3 install ara[server]"

View File

@ -1,10 +1,10 @@
#!/bin/bash -x
# Builds an ARA API server container image from Fedora 32 distribution packages.
build=$(buildah from fedora:32)
# Builds an ARA API server container image from Fedora 33 distribution packages.
build=$(buildah from fedora:33)
# Get all updates, install the ARA API server, database backends and gunicorn application server
# This lets users swap easily from the sqlite default to mysql or postgresql just by tweaking settings.yaml.
buildah run "${build}" -- /bin/bash -c "dnf update -y && dnf install -y ara ara-server python3-psycopg2 python3-mysql python3-gunicorn && dnf clean all"
buildah run "${build}" -- /bin/bash -c "dnf update -y && dnf install -y ara ara-server which python3-psycopg2 python3-mysql python3-gunicorn && dnf clean all"
# Set up the container to execute SQL migrations and run the API server with gunicorn
buildah config --env ARA_BASE_DIR=/opt/ara "${build}"

View File

@ -1,19 +1,16 @@
#!/bin/bash -x
# Builds an ARA API server container image using the latest PyPi packages on Fedora 32.
build=$(buildah from fedora:32)
# Builds an ARA API server container image using the latest PyPi packages on Fedora 33.
build=$(buildah from fedora:33)
# Get all updates, install pip, database backends and gunicorn application server
# This lets users swap easily from the sqlite default to mysql or postgresql just by tweaking settings.yaml.
# Note: We use the packaged versions of psycopg2 and mysql python libraries so
# we don't need to install development libraries before installing them from PyPi.
buildah run "${build}" -- /bin/bash -c "dnf update -y && dnf install -y python3-pip python3-psycopg2 python3-mysql python3-gunicorn && dnf clean all"
buildah run "${build}" -- /bin/bash -c "dnf update -y && dnf install -y which python3-pip python3-psycopg2 python3-mysql python3-gunicorn && dnf clean all"
# Install ara from source with API server extras for dependencies (django & django-rest-framework)
buildah run "${build}" -- /bin/bash -c "pip3 install ara[server]"
# TODO: Remove after 1.4.2 is released with pyyaml/ruamel.yaml fix
buildah run "${build}" -- /bin/bash -c "pip3 install PyYAML"
# Set up the container to execute SQL migrations and run the API server with gunicorn
buildah config --env ARA_BASE_DIR=/opt/ara "${build}"
buildah config --cmd "bash -c '/usr/local/bin/ara-manage migrate && /usr/bin/gunicorn-3 --workers=4 --access-logfile - --bind 0.0.0.0:8000 ara.server.wsgi'" "${build}"

View File

@ -1,5 +1,5 @@
#!/bin/bash -x
# Builds an ARA API server container image from checked out source on Fedora 32.
# Builds an ARA API server container image from checked out source on Fedora 33.
# Figure out source directory relative to the contrib/container-images directory
SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
SOURCE_DIR=$(cd "${SCRIPT_DIR}/../.." && pwd -P)
@ -10,13 +10,13 @@ python3 setup.py sdist
sdist=$(ls dist/ara-*.tar.gz)
popd
build=$(buildah from fedora:32)
build=$(buildah from fedora:33)
# Get all updates, install pip, database backends and gunicorn application server
# This lets users swap easily from the sqlite default to mysql or postgresql just by tweaking settings.yaml.
# Note: We use the packaged versions of psycopg2 and mysql python libraries so
# we don't need to install development libraries before installing them from PyPi.
buildah run "${build}" -- /bin/bash -c "dnf update -y && dnf install -y python3-pip python3-psycopg2 python3-mysql python3-gunicorn && dnf clean all"
buildah run "${build}" -- /bin/bash -c "dnf update -y && dnf install -y which python3-pip python3-psycopg2 python3-mysql python3-gunicorn && dnf clean all"
# Install ara from source with API server extras for dependencies (django & django-rest-framework)
buildah run --volume ${SOURCE_DIR}:/usr/local/src/ara:z "${build}" -- /bin/bash -c "pip3 install /usr/local/src/ara/${sdist}[server]"

View File

@ -25,17 +25,17 @@
# These are in chronological order of release so that we don't end up
# running SQL migrations backwards during the tests.
- name: localhost/ara-api
tag: fedora32-source-latest
script: fedora32-source.sh
tag: fedora33-source-latest
script: fedora33-source.sh
- name: localhost/ara-api
tag: fedora32-pypi-latest
script: fedora32-pypi.sh
tag: fedora33-pypi-latest
script: fedora33-pypi.sh
- name: localhost/ara-api
tag: centos8-pypi-latest
script: centos8-pypi.sh
- name: localhost/ara-api
tag: fedora32-distribution-latest
script: fedora32-distribution.sh
tag: fedora33-distribution-latest
script: fedora33-distribution.sh
tasks:
- name: Install git, buildah and podman
become: yes

View File

@ -23,22 +23,22 @@
images:
# These images are meant to be provided by the "with_container_images.yaml" playbook
- name: localhost/ara-api
tag: fedora32-source-latest
tag: fedora33-source-latest
- name: localhost/ara-api
tag: fedora32-pypi-latest
tag: fedora33-pypi-latest
- name: localhost/ara-api
tag: centos8-pypi-latest
- name: localhost/ara-api
tag: fedora32-distribution-latest
tag: fedora33-distribution-latest
tasks:
- name: Tag images with buildah
command: |
buildah tag {{ item.name }}:{{ item.tag }} {{ destination }}:{{ item.tag }}
loop: "{{ images }}"
- name: Tag latest from fedora32-source-latest
- name: Tag latest from fedora33-source-latest
command: |
buildah tag {{ destination }}:fedora32-source-latest {{ destination }}:latest
buildah tag {{ destination }}:fedora33-source-latest {{ destination }}:latest
- name: Push latest
command: |