The httpd image is based on Debian and the ondrej repo is designed for Ubuntu, the two are related but it is going to cause you problems.
When add-apt-repository runs it adds the PPA for your current system version, the httpd image is using Debian buster which is equivalent to Ubuntu hirsute (21.04) which isn't released and there is no packages in the PPA for it.
You can work around this by doing the import manually and specifying an ubuntu version (groovy in this case):
RUN apt-get update && apt-get install gpg && echo -n 'deb http://ppa.launchpad.net/ondrej/php/ubuntu groovy main' > /etc/apt/sources.list.d/ondrej-ubuntu-php-groovy.list &&
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C
However you are just going to run into further problems. I would recommend starting with an Ubuntu base and installing everything you need:
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y software-properties-common
RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
RUN apt-get update -y && apt-get install -y apache2
RUN apt-get update -y && apt-get install -y php7.2
libapache2-mod-php7.2
php7.2-common
php7.2-mysql
php7.2-gmp
php7.2-ldap
php7.2-curl
php7.2-intl
php7.2-mbstring
php7.2-xmlrpc
php7.2-gd
php7.2-bcmath
php7.2-xml
php7.2-cli
php7.2-zip
Sending build context to Docker daemon 4.608kB
Step 1/5 : FROM ubuntu:20.04
---> f63181f19b2f
Step 2/5 : RUN apt-get update && apt-get install -y software-properties-common
---> Running in 375ea87dedcf
[snip]
---> 01f569d22228
Removing intermediate container 375ea87dedcf
Step 3/5 : RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
---> Running in b28c033f910c
[snip]
---> cbc543280aac
Removing intermediate container b28c033f910c
Step 4/5 : RUN apt-get update -y && apt-get install -y apache2
---> Running in 63de13b5676e
[snip]
---> 917b1cdcd5c3
Removing intermediate container 63de13b5676e
Step 5/5 : RUN apt-get update -y && apt-get install -y php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mysql php7.2-gmp php7.2-ldap php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-gd php7.2-bcmath php7.2-xml php7.2-cli php7.2-zip
---> Running in fe46743f3534
[snip]
---> ce93f9470361
Removing intermediate container fe46743f3534
Successfully built ce93f9470361
It's worth noting that there is a warning about setting the correct locale in the PPA description, it should be: LC_ALL=C.UTF-8
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…