i am trying to use Docker for an Django project but i got an issue when i try to build a image. the Dockerfile :
# pull the official base image
FROM python:3.8.3-alpine
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt /usr/src/app
RUN pip install -r requirements.txt
# copy project
COPY . /usr/src/app
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]`
the requirements.txt file:
asgiref==3.4.1 certifi==2022.12.7 cffi==1.15.0 charset-normalizer==3.1.0 cryptography==35.0.0 distlib==0.3.6 Django==3.2.9 django-crispy-forms==1.13.0 django-extensions==3.1.5 django-sslserver==0.22 filelock==3.10.0 idna==3.4 mysqlclient==2.1.1 paho-mqtt==1.6.1 platformdirs==3.1.1 pycparser==2.21 pyOpenSSL==21.0.0 PyQt5==5.15.7 PyQt5-Qt5==5.15.2 PyQt5-sip==12.11.0 pytz==2021.3 requests==2.28.2 six==1.16.0 sqlparse==0.4.2 urllib3==1.26.14 virtualenv==20.21.0 Werkzeug==2.0.2
the problem at the terminal :
Downloading mysqlclient-2.1.1.tar.gz (88 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.1/88.1 kB 3.9 MB/s eta 0:00:00
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
mysql_config --version
/bin/sh: mysql_config: not found
mariadb_config --version
/bin/sh: mariadb_config: not found
mysql_config --libs
/bin/sh: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-p4jxebcw/mysqlclient_30d2d8c61a2245239a1308ab8f3dd8ea/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-p4jxebcw/mysqlclient_30d2d8c61a2245239a1308ab8f3dd8ea/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-p4jxebcw/mysqlclient_30d2d8c61a2245239a1308ab8f3dd8ea/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
is anyone had the same issue ?
maybe i should not have a requirements.txt file ?