Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

レガシーな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

https://github.com/sonicjam/docker-php-5.2-apache

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away