I'm using Python 3.7 and Django 2. I have the following requirements.txt file, exported from my current project ...
asgiref==3.2.3
Babel==2.8.0
Django==2.0
django-address==0.2.1
django-mysql==3.3.0
django-phonenumber-field==4.0.0
mysqlclient==1.4.6
phonenumbers==8.11.2
pycountry==19.8.18
pytz==2019.3
PyYAML==5.3
ruamel.yaml==0.16.6
ruamel.yaml.clib==0.2.0
sqlparse==0.3.0
I would like to create a docker image to run my Django virutal environment. I have this Dockerfile ...
FROM python:3.7-slim
RUN python -m pip install --upgrade pip
COPY requirements.txt requirements.txt
RUN python -m pip install -r requirements.txt
COPY . .
However I'm getting this error when I attempt to build the image. I'm not certain what it means. I can run the server (python manage.py runserver 8000) without problems so not sure why my virtual environment is dying ...
(venv) localhost:web davea$ docker build .
Sending build context to Docker daemon 132.5MB
Step 1/5 : FROM python:3.7-slim
---> f2d2e1dc8c72
Step 2/5 : RUN python -m pip install --upgrade pip
---> Using cache
---> cf901765d254
Step 3/5 : COPY requirements.txt requirements.txt
---> Using cache
---> e4770d5b0c4a
Step 4/5 : RUN python -m pip install -r requirements.txt
---> Running in d4d937c92f06
Collecting asgiref==3.2.3
Downloading asgiref-3.2.3-py2.py3-none-any.whl (18 kB)
Collecting Babel==2.8.0
Downloading Babel-2.8.0-py2.py3-none-any.whl (8.6 MB)
Collecting Django==2.0
Downloading Django-2.0-py3-none-any.whl (7.1 MB)
Collecting django-address==0.2.1
Downloading django-address-0.2.1.tar.gz (16 kB)
Collecting django-mysql==3.3.0
Downloading django_mysql-3.3.0-py3-none-any.whl (63 kB)
Collecting django-phonenumber-field==4.0.0
Downloading django_phonenumber_field-4.0.0-py3-none-any.whl (51 kB)
Collecting mysqlclient==1.4.6
Downloading mysqlclient-1.4.6.tar.gz (85 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2p1gjaea/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2p1gjaea/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-2p1gjaea/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-2p1gjaea/mysqlclient/
Complete output (12 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-2p1gjaea/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/tmp/pip-install-2p1gjaea/mysqlclient/setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-2p1gjaea/mysqlclient/setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.