GrahamDumpleton / mod_wsgi-docker

Docker images for Apache/mod_wsgi.
Apache License 2.0
72 stars 36 forks source link

Resolving dependencies #11

Closed nordri closed 7 years ago

nordri commented 7 years ago

Hi there, I'm using Python-MySQL as connector to MySQL. So I've added it in requirements.txt file. But this module depends on MySQL-dev to be compiled and the build of docker image fail, because that package isn't present. So, I do this workaround to fix the problem, I've added this code in the Dockerfile

RUN apt-get update && apt-get install -y \
                mysql-client libmysqlclient-dev \
        --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN pip install MySQL-python

But in some way, I think it should be another way to deal with dependencies in this Dockerfile. What do you think? Shall I look for another Dockerfile or use another SQL Connector? Thank you very much.

GrahamDumpleton commented 7 years ago

I have added libmysqlclient-dev and libpq-dev. I have not added mysql-client as it isn't necessarily best practice to provide the database cli in the image for the web application. If you need cli access, access the host/container that the database is running in.

Do note that although I have added these two database client libraries, this image is going to be in time superseded by a different image which already had the database client libraries and much much more. The new image is much better in many ways. This image will still stay around for some time though.