Upgrade to Python 3.9

This commit is contained in:
Shane McDonald
2022-01-07 19:50:17 -05:00
parent aa9124e072
commit 44968cc01e
2 changed files with 64 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
PYTHON ?= python3.8 PYTHON ?= python3.9
PYTHON_VERSION = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_version; print(get_python_version())") PYTHON_VERSION = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_version; print(get_python_version())")
OFFICIAL ?= no OFFICIAL ?= no
NODE ?= node NODE ?= node

View File

@@ -5,7 +5,7 @@
### ###
# Build container # Build container
FROM quay.io/centos/centos:8 as builder FROM quay.io/centos/centos:stream9 as builder
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en ENV LANGUAGE en_US:en
@@ -15,11 +15,12 @@ ENV LC_ALL en_US.UTF-8
USER root USER root
# Install build dependencies # Install build dependencies
RUN dnf -y module enable 'postgresql:12' RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
RUN dnf -y update && \ dnf config-manager --set-enabled crb && \
dnf -y install epel-release 'dnf-command(config-manager)' && \ dnf -y install \
dnf module -y enable 'postgresql:12' && \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
dnf config-manager --set-enabled powertools && \ https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm \
&& \
dnf -y install \ dnf -y install \
gcc \ gcc \
gcc-c++ \ gcc-c++ \
@@ -34,18 +35,18 @@ RUN dnf -y update && \
nss \ nss \
openldap-devel \ openldap-devel \
patch \ patch \
@postgresql:12 \ postgresql \
postgresql-devel \ postgresql-devel \
python38-devel \ python3-devel \
python38-pip \ python3-pip \
python38-psycopg2 \ python3-psycopg2 \
python38-setuptools \ python3-setuptools \
swig \ swig \
unzip \ unzip \
xmlsec1-devel \ xmlsec1-devel \
xmlsec1-openssl-devel xmlsec1-openssl-devel
RUN python3.8 -m ensurepip && pip3 install "virtualenv < 20" RUN pip3 install "virtualenv < 20"
# Install & build requirements # Install & build requirements
@@ -85,7 +86,7 @@ RUN SKIP_PG_VERSION_CHECK=yes /var/lib/awx/venv/awx/bin/awx-manage collectstatic
{% endif %} {% endif %}
# Final container(s) # Final container(s)
FROM quay.io/centos/centos:8 FROM quay.io/centos/centos:stream9
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en ENV LANGUAGE en_US:en
@@ -94,32 +95,32 @@ ENV LC_ALL en_US.UTF-8
USER root USER root
# Install runtime requirements # Install runtime requirements
RUN dnf -y module enable 'postgresql:12' RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
RUN dnf -y update && \ dnf config-manager --set-enabled crb && \
dnf -y install epel-release 'dnf-command(config-manager)' && \ dnf -y install \
dnf module -y enable 'postgresql:12' && \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
dnf config-manager --set-enabled powertools && \ https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm \
&& \
dnf -y install acl \ dnf -y install acl \
git-core \ git-core \
git-lfs \ git-lfs \
glibc-langpack-en \ glibc-langpack-en \
krb5-workstation \ krb5-workstation \
libcgroup-tools \
nginx \ nginx \
@postgresql:12 \ postgresql \
python3-devel \ python3-devel \
python3-libselinux \ python3-libselinux \
python38-pip \ python3-pip \
python38-psycopg2 \ python3-psycopg2 \
python38-setuptools \ python3-setuptools \
rsync \ rsync \
"rsyslog >= 8.1911.0" \
subversion \ subversion \
sudo \ sudo \
vim-minimal \ vim-minimal \
which \ which \
unzip \ unzip \
xmlsec1-openssl && \ xmlsec1-openssl && \
dnf -y install centos-release-stream && dnf -y install "rsyslog >= 8.1911.0" && dnf -y remove centos-release-stream && \
dnf -y clean all dnf -y clean all
RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 && \ RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 && \
@@ -130,7 +131,7 @@ RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master
RUN curl -L -o /usr/bin/tini https://github.com/krallin/tini/releases/download/v0.19.0/tini-{{ tini_architecture | default('amd64') }} && \ RUN curl -L -o /usr/bin/tini https://github.com/krallin/tini/releases/download/v0.19.0/tini-{{ tini_architecture | default('amd64') }} && \
chmod +x /usr/bin/tini chmod +x /usr/bin/tini
RUN python3.8 -m ensurepip && pip3 install "virtualenv < 20" supervisor RUN pip3 install "virtualenv < 20" supervisor
RUN rm -rf /root/.cache && rm -rf /tmp/* RUN rm -rf /root/.cache && rm -rf /tmp/*
@@ -144,6 +145,7 @@ RUN dnf -y install \
alsa-lib \ alsa-lib \
libX11-xcb \ libX11-xcb \
libXScrnSaver \ libXScrnSaver \
iproute \
strace \ strace \
vim \ vim \
nmap-ncat \ nmap-ncat \
@@ -164,23 +166,9 @@ RUN pip3 install black git+https://github.com/coderanger/supervisor-stdout
# This package randomly fails to download. # This package randomly fails to download.
# It is nice to have in the dev env, but not necessary. # It is nice to have in the dev env, but not necessary.
# Add it back to the list above if the repo ever straighten up. # Add it back to the list above if the repo ever straighten up.
RUN dnf --enablerepo=debuginfo -y install python3-debuginfo || : RUN dnf --enablerepo=baseos-debug -y install python3-debuginfo || :
{% endif %} {% endif %}
{% if build_dev|bool %}
RUN dnf install -y podman
RUN echo -e '[engine]\ncgroup_manager = "cgroupfs"\nevents_logger = "file"\nruntime = "crun"' > /etc/containers/containers.conf
{% endif %}
# Fix overlay filesystem issue
{% if build_dev|bool %}
RUN sed -i '/^#mount_program/s/^#//' /etc/containers/storage.conf
{% endif %}
# Ensure we must use fully qualified image names
# This prevents podman prompt that hangs when trying to pull unqualified images
RUN mkdir -p /etc/containers/registries.conf.d/ && echo "unqualified-search-registries = []" >> /etc/containers/registries.conf.d/force-fully-qualified-images.conf && chmod 644 /etc/containers/registries.conf.d/force-fully-qualified-images.conf
# Copy app from builder # Copy app from builder
COPY --from=builder /var/lib/awx /var/lib/awx COPY --from=builder /var/lib/awx /var/lib/awx
@@ -188,12 +176,26 @@ RUN ln -s /var/lib/awx/venv/awx/bin/awx-manage /usr/bin/awx-manage
{%if build_dev|bool %} {%if build_dev|bool %}
COPY --from={{ receptor_image }} /usr/bin/receptor /usr/bin/receptor COPY --from={{ receptor_image }} /usr/bin/receptor /usr/bin/receptor
RUN openssl req -nodes -newkey rsa:2048 -keyout /etc/nginx/nginx.key -out /etc/nginx/nginx.csr \ RUN openssl req -nodes -newkey rsa:2048 -keyout /etc/nginx/nginx.key -out /etc/nginx/nginx.csr \
-subj "/C=US/ST=North Carolina/L=Durham/O=Ansible/OU=AWX Development/CN=awx.localhost" && \ -subj "/C=US/ST=North Carolina/L=Durham/O=Ansible/OU=AWX Development/CN=awx.localhost" && \
openssl x509 -req -days 365 -in /etc/nginx/nginx.csr -signkey /etc/nginx/nginx.key -out /etc/nginx/nginx.crt && \ openssl x509 -req -days 365 -in /etc/nginx/nginx.csr -signkey /etc/nginx/nginx.key -out /etc/nginx/nginx.crt && \
chmod 640 /etc/nginx/nginx.{csr,key,crt} chmod 640 /etc/nginx/nginx.{csr,key,crt}
{% endif %} {% endif %}
{% if build_dev|bool %}
RUN dnf install -y podman && rpm --restore shadow-utils 2>/dev/null
# chmod containers.conf and adjust storage.conf to enable Fuse storage.
RUN sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf
ENV _CONTAINERS_USERNS_CONFIGURED=""
# Ensure we must use fully qualified image names
# This prevents podman prompt that hangs when trying to pull unqualified images
RUN mkdir -p /etc/containers/registries.conf.d/ && echo "unqualified-search-registries = []" >> /etc/containers/registries.conf.d/force-fully-qualified-images.conf && chmod 644 /etc/containers/registries.conf.d/force-fully-qualified-images.conf
{% endif %}
# Create default awx rsyslog config # Create default awx rsyslog config
ADD tools/ansible/roles/dockerfile/files/rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf ADD tools/ansible/roles/dockerfile/files/rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf
ADD tools/ansible/roles/dockerfile/files/wait-for-migrations /usr/local/bin/wait-for-migrations ADD tools/ansible/roles/dockerfile/files/wait-for-migrations /usr/local/bin/wait-for-migrations
@@ -209,6 +211,8 @@ ADD tools/docker-compose/start_tests.sh /start_tests.sh
ADD tools/docker-compose/bootstrap_development.sh /usr/bin/bootstrap_development.sh ADD tools/docker-compose/bootstrap_development.sh /usr/bin/bootstrap_development.sh
ADD tools/docker-compose/entrypoint.sh /entrypoint.sh ADD tools/docker-compose/entrypoint.sh /entrypoint.sh
ADD tools/scripts/config-watcher /usr/bin/config-watcher ADD tools/scripts/config-watcher /usr/bin/config-watcher
ADD https://raw.githubusercontent.com/containers/libpod/master/contrib/podmanimage/stable/containers.conf /etc/containers/containers.conf
ADD https://raw.githubusercontent.com/containers/libpod/master/contrib/podmanimage/stable/podman-containers.conf /var/lib/awx/.config/containers/containers.conf
{% else %} {% else %}
ADD tools/ansible/roles/dockerfile/files/launch_awx.sh /usr/bin/launch_awx.sh ADD tools/ansible/roles/dockerfile/files/launch_awx.sh /usr/bin/launch_awx.sh
ADD tools/ansible/roles/dockerfile/files/launch_awx_task.sh /usr/bin/launch_awx_task.sh ADD tools/ansible/roles/dockerfile/files/launch_awx_task.sh /usr/bin/launch_awx_task.sh
@@ -233,7 +237,7 @@ RUN for dir in \
/var/run/supervisor \ /var/run/supervisor \
/var/run/awx-receptor \ /var/run/awx-receptor \
/var/lib/nginx ; \ /var/lib/nginx ; \
do mkdir -m 0775 -p $dir ; chmod g+rw $dir ; chgrp root $dir ; done && \ do mkdir -m 0775 -p $dir ; chmod g+rwx $dir ; chgrp root $dir ; done && \
for file in \ for file in \
/etc/subuid \ /etc/subuid \
/etc/subgid \ /etc/subgid \
@@ -244,19 +248,32 @@ RUN for dir in \
{% if (build_dev|bool) or (kube_dev|bool) %} {% if (build_dev|bool) or (kube_dev|bool) %}
RUN for dir in \ RUN for dir in \
/etc/containers \
/var/lib/awx/.config/containers \
/var/lib/awx/.config/cni \
/var/lib/awx/venv \ /var/lib/awx/venv \
/var/lib/awx/venv/awx/bin \ /var/lib/awx/venv/awx/bin \
/var/lib/awx/venv/awx/lib/python3.8 \ /var/lib/awx/venv/awx/lib/python3.9 \
/var/lib/awx/venv/awx/lib/python3.8/site-packages \ /var/lib/awx/venv/awx/lib/python3.9/site-packages \
/var/lib/awx/projects \ /var/lib/awx/projects \
/var/lib/awx/rsyslog \ /var/lib/awx/rsyslog \
/var/run/awx-rsyslog \ /var/run/awx-rsyslog \
/.ansible \ /.ansible \
/var/lib/shared/overlay-images \
/var/lib/shared/overlay-layers \
/var/lib/shared/vfs-images \
/var/lib/shared/vfs-layers \
/var/lib/awx/vendor ; \ /var/lib/awx/vendor ; \
do mkdir -m 0775 -p $dir ; chmod g+rw $dir ; chgrp root $dir ; done && \ do mkdir -m 0775 -p $dir ; chmod g+rwx $dir ; chgrp root $dir ; done && \
for file in \ for file in \
/etc/containers/containers.conf \
/var/lib/awx/.config/containers/containers.conf \
/var/lib/shared/overlay-images/images.lock \
/var/lib/shared/overlay-layers/layers.lock \
/var/lib/shared/vfs-images/images.lock \
/var/lib/shared/vfs-layers/layers.lock \
/var/run/nginx.pid \ /var/run/nginx.pid \
/var/lib/awx/venv/awx/lib/python3.8/site-packages/awx.egg-link ; \ /var/lib/awx/venv/awx/lib/python3.9/site-packages/awx.egg-link ; \
do touch $file ; chmod g+rw $file ; done do touch $file ; chmod g+rw $file ; done
{% endif %} {% endif %}
@@ -282,5 +299,5 @@ EXPOSE 8052
ENTRYPOINT ["/usr/bin/tini", "--"] ENTRYPOINT ["/usr/bin/tini", "--"]
CMD /usr/bin/launch_awx.sh CMD /usr/bin/launch_awx.sh
VOLUME /var/lib/nginx VOLUME /var/lib/nginx
VOLUME /var/lib/awx/.local/share/containers/storage VOLUME /var/lib/awx/.local/share/containers
{% endif %} {% endif %}