I am attempting to push a docker build of a python lambda function to AWS with the following command (minus the build args):
docker build --build-arg PROD_DB_HOST="xxx.us-east-1.rds.amazonaws.com" -t vbam-etf-change-report .
The contents of my requirements.txt file:
mysqlclient==2.0.3
python-dotenv
The contents of my Dockerfile (minus program argument environment variables):
FROM public.ecr.aws/lambda/python:3.8
# Copy function code
COPY ETFChangeReportlLambda.py ${LAMBDA_TASK_ROOT}
# Avoid cache purge by adding requirements first
COPY requirements.txt ${LAMBDA_TASK_ROOT}
RUN pip install --no-cache-dir -r requirements.txt
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "ETFChangeReportlLambda.handler" ]
The error:
#7 [4/4] RUN pip install --no-cache-dir -r requirements.txt
#7 sha256:1ea7868443d498b5222a02c472168a9dc59c8bdf685330406552a2733ad1f356
#7 0.576 Collecting mysqlclient==2.0.3
#7 0.610 Downloading mysqlclient-2.0.3.tar.gz (88 kB)
#7 0.616 ΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöüΓöü 88.9/88.9 KB 27.3 MB/s eta 0:00:00
#7 0.631 Preparing metadata (setup.py): started
#7 0.746 Preparing metadata (setup.py): finished with status 'error'
#7 0.751 error: subprocess-exited-with-error
#7 0.751
#7 0.751 × python setup.py egg_info did not run successfully.
#7 0.751 Γöé exit code: 1
#7 0.751 Γò░ΓöÇ> [16 lines of output]
#7 0.751 /bin/sh: mysql_config: command not found
#7 0.751 /bin/sh: mariadb_config: command not found
#7 0.751 /bin/sh: mysql_config: command not found
#7 0.751 Traceback (most recent call last):
#7 0.751 File "<string>", line 2, in <module>
#7 0.751 File "<pip-setuptools-caller>", line 34, in <module>
#7 0.751 File "/tmp/pip-install-u5vr3ps6/mysqlclient_7d2089be268641c8a9eb33bc95cf2873/setup.py", line 15, in <module>
#7 0.751 metadata, options = get_config()
#7 0.751 File "/tmp/pip-install-u5vr3ps6/mysqlclient_7d2089be268641c8a9eb33bc95cf2873/setup_posix.py", line 70, in get_config
#7 0.751 libs = mysql_config("libs")
#7 0.751 File "/tmp/pip-install-u5vr3ps6/mysqlclient_7d2089be268641c8a9eb33bc95cf2873/setup_posix.py", line 31, in mysql_config
#7 0.751 raise OSError("{} not found".format(_mysql_config_path))
#7 0.751 OSError: mysql_config not found
#7 0.751 mysql_config --version
#7 0.751 mariadb_config --version
#7 0.751 mysql_config --libs
#7 0.751 [end of output]
#7 0.751
#7 0.751 note: This error originates from a subprocess, and is likely not a problem with pip.
#7 0.753 error: metadata-generation-failed
#7 0.753
#7 0.753 × Encountered error while generating package metadata.
#7 0.753 Γò░ΓöÇ> See above for output.
#7 0.753
#7 0.753 note: This is an issue with the package mentioned above, not pip.
#7 0.753 hint: See above for details.
#7 ERROR: executor failed running [/bin/sh -c pip install --no-cache-dir -r requirements.txt]: exit code: 1
------
> [4/4] RUN pip install --no-cache-dir -r requirements.txt:
------
executor failed running [/bin/sh -c pip install --no-cache-dir -r requirements.txt]: exit code: 1
Is there something I can do to the Dockerfile to help with the "OSError: myssql_config not found) error?