Why not try it with an other image?
I used:
default:
image: ubuntu:20.04
services:
- mysql:8.0
and
before_script:
- apt -y update
- apt -y install apt-utils
- apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev
- apt -y upgrade
- pip3 install -r requirements.txt
Worked for a Django project. Of course you use the image and python version that comes closes to your production environment.