使用Docker定制TYPO3的开发镜像

来自极益平台知识库
跳转至: 导航搜索

Dockerfile

FROM php:7-apache
MAINTAINER Martin Helmich <typo3@martin-helmich.de>
RUN  sed -i s@/deb.debian.org/@/mirrors.163.com/@g /etc/apt/sources.list  
RUN  apt-get clean  
# Install TYPO3
RUN apt-get update &&\
   apt-get install -y wget
#RUN cd /var/www/html && \
#    wget -O - https://get.typo3.org/8 | tar -xzf - && \
#    ln -s typo3_src-* typo3_src && \
#    ln -s typo3_src/index.php && \
#    ln -s typo3_src/typo3 && \
#    ln -s typo3_src/_.htaccess .htaccess && \
#    mkdir typo3temp && \
#    mkdir typo3conf && \
#    mkdir fileadmin && \
#    mkdir uploads && \
#    touch FIRST_INSTALL && \
#    chown -R www-data. .
# Configure PHP
RUN apt-get install -y \
       libxml2-dev libfreetype6-dev \
       libjpeg62-turbo-dev \
       libmcrypt-dev \
       libpng12-dev \
       zlib1g-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
   docker-php-ext-install -j$(nproc) mysqli soap gd zip
RUN echo 'always_populate_raw_post_data = -1\nmax_execution_time = 240\nmax_input_vars = 1500\nupload_max_filesize = 32M\npost_max_size = 32M' > /usr/local/etc/php/conf.d/typo3.ini
# Install required 3rd party tools
RUN apt-get install -y graphicsmagick
# Configure Apache as needed
RUN a2enmod rewrite
# Configure volumes
VOLUME /var/www/html/

操作

将如上文件存为Dockerfile文件,无后缀名

然后在Dockerfile文件所在目录,cmd下执行

docker build -t typo3box .

会生成一个名为typo3box的镜像。

启动镜像,并链接到数据库。

docker run -d --name typo3box --link typo3db typo3box

启动这个镜像后,在kitematic中点击/var/www/html路径,打开windows下关联目录。拷贝文件进去后开始安装。