Dockerでmroongaを動かす

ほぼ前回と同様なのでDockerfileだけ記載しておきます。

From ubuntu:quantal

# my.cnfをコピー
ADD my.cnf /etc/mysql/my.cnf

# security updateを追加
RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ quantal-updates main restricted" >> /etc/apt/sources.list
RUN echo "deb-src http://us.archive.ubuntu.com/ubuntu/ quantal-updates main restricted" >> /etc/apt/sources.list
RUN apt-get update

# /sbin/initctlが原因でmysql-serverが起動しない問題へのhack
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl

# mysql-serverのインストール
RUN echo 'mysql-server-<version> mysql-server/root_password password password' | debconf-set-selections
RUN echo 'mysql-server-<version> mysql-server/root_password_again password password' | debconf-set-selections
RUN apt-get install -y -o Dpkg::Options::="--force-confold" mysql-common
RUN apt-get install -y mysql-server
RUN (/usr/bin/mysqld_safe &); sleep 3; echo "grant all privileges on *.* to root@'%';" | mysql -u root -ppassword


RUN echo "deb http://packages.groonga.org/ubuntu/ quantal universe" > /etc/apt/sources.list.d/groonga.list
RUN echo "deb-src http://packages.groonga.org/ubuntu/ quantal universe" >> /etc/apt/sources.list.d/groonga.list

RUN apt-get update; apt-get -y --allow-unauthenticated install groonga-keyring
RUN apt-get update
RUN (/usr/bin/mysqld_safe &); sleep 3; apt-get -y install mysql-server-mroonga
RUN apt-get -y install groonga-tokenizer-mecab
RUN apt-get -y install groonga-normalizer-mysql

EXPOSE 3306

CMD ["/usr/bin/mysqld_safe"]