ComboStrikeHQ / docker-rails

An opinionated docker image for running Rails apps in production.
MIT License
89 stars 17 forks source link

mysql support #4

Closed drummerroma closed 8 years ago

drummerroma commented 8 years ago

How could I add mysql-support? I tried to build image form this dockerfile:

# Dockerfile
FROM ad2games/docker-rails:latest
RUN apt-get install -qq -y mysql-client libmysqlclient-dev 

but this does not work. Also adding new packages by ENV APT_PACKAGES from the docker command does not resolve.

dziemba commented 8 years ago

Thanks for opening the issue and providing the steps you have tried!

It's quite difficult to add more APT packages once the baseimage has been built, because we use heavy cleanup/minifying/squashing to ensure fast download times. Also the ONBUILD commands run before your added RUN command.

Your idea of adding the mysql-dev packages to APT_PACKAGES is correct, however this has to be done at build-time of the baseimage.

Since using MySQL seems to be a common use-case, I added support for it to the image. The latest version 2.4.0 now supports the mysql2 gem.

Here's how it's done: https://github.com/ad2games/docker-rails/commit/0e91d2c67b0ca4cf7e3f580548ecfbbd856953f1

Please let me know if you have any more issues with this.