LoginSignup
7
3

More than 5 years have passed since last update.

レガシーなLAMP+memcacheシステムのDockerFileを書いてみた

Last updated at Posted at 2017-04-05

レガシーなLAMP+memcacheシステムをdocker内で開発、検証するために
DockerFileを記載してみました。

構成
centos 6.7
php 5.2.17
mysql 5.1.73
apache 2.2.0
memcached1.4.4


FROM centos:6.7

MAINTAINER terui-yuki

ENV PHP_VERSION 5.2.17


RUN yum update -y

RUN yum -y install wget && \
    yum install -y tar.x86_64 && \
    yum install -y  bzip2 && \
    yum install -y  gcc


#### apache
RUN yum -y install httpd httpd-devel

#### PHP 5.2 関連
RUN yum install -y  epel-release
RUN yum install -y \
  libaio-devel \
  libmcrypt-devel \
  libjpeg-devel \
  libpng-devel \
  libxml2-devel \
  libxslt-devel \
  curl-devel \
  freetype-devel \
  gmp-devel \
  mysql-devel \
  openssl-devel \
  postgresql-devel \
  libjpeg \ 
  libmemcached


RUN yum install -y --enablerepo=epel \
  libmcrypt \
  libmcrypt-devel \
  php-mcrypt

RUN ln -s /usr/lib64/libjpeg.so /usr/lib/ && ln -s /usr/lib64/libpng.so /usr/lib/


### PHP 5.2 ソースから
WORKDIR /usr/local/src
ADD http://museum.php.net/php5/php-${PHP_VERSION}.tar.bz2 ./
RUN tar xf ./php-${PHP_VERSION}.tar.bz2 -C ./
WORKDIR ./php-${PHP_VERSION}
RUN ./configure \
  --enable-gd-native-ttf \
  --enable-mbregex \
  --enable-mbstring \
  --enable-soap \
  --enable-zend-multibyte \
  --enable-zip \
  --with-apxs2 \
  --with-curl \
  --with-freetype-dir=/usr \
  --with-gd \
  --with-gettext \
  --with-gmp \
  --with-jpeg-dir=/usr \
  --with-mcrypt \
  --with-mysql-sock \
  --with-openssl \
  --with-pear \
  --with-pdo-mysql \
  --with-pdo-pgsql \
  --with-png-dir=/usr \
  --with-xsl \
  --with-zlib \
  --with-pear=/usr/local/pear \
  --with-apxs2=/usr/sbin/apxs
RUN make && make test && make install

### mysql
RUN yum install -y mysql-server


### memcache  コードから入れてみる
RUN yum install -y  gcc-c++
WORKDIR /usr/local/src
ADD https://pecl.php.net/get/memcached-2.1.0.tgz ./
#ADD https://pecl.php.net/get/memcache-2.2.7.tgz ./
ADD https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz ./
RUN tar -zxvf ./memcached-2.1.0.tgz  -C ./
#RUN tar -zxvf ./memcache-2.2.7.tgz  -C ./
RUN tar -zxvf ./libmemcached-1.0.18.tar.gz  -C ./



WORKDIR /usr/local/src/libmemcached-1.0.18
RUN ./configure --without-memcached && make && make install

WORKDIR /usr/local/src/memcached-2.1.0
RUN phpize
RUN ./configure --with-php-config=/usr/local/bin/php-config --disable-memcached-sasl && make && make install

#WORKDIR /usr/local/src/memcache-2.2.7
#RUN phpize
#RUN ./configure --with-php-config=/usr/local/bin/php-config --disable-memcached-sasl && make && make install

RUN yum install -y  memcached

EXPOSE 80


CMD [ "/usr/sbin/httpd", "-D", "FOREGROUND" ]

起動テスト

docker run -i -t --rm -p 80:80 イメージ[:タグ|@ダイジェスト値] /bin/bash

参考にさせていただいたURL

7
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3