---
# System prepended metadata

title: Perl&PHP application Dockerfile

---

# Perl&PHP application Dockerfile
## Dockerfile
```
FROM php:5.6.21-apache
COPY apache2.conf /bin/
COPY init_container.sh /bin/
COPY hostingstart.html /home/site/wwwroot/hostingstart.html
RUN a2enmod rewrite expires include deflate
# install the PHP extensions we need
RUN \
        DEBIAN_FRONTEND=noninteractive && \
        apt-get update -y && \
        apt-get install -y \
        make \
        unixodbc-dev \
        build-essential \
        apt-utils \
        ssl-cert \
        apache2 \
        apache2-utils \
        apache2-dev \
        libapache2-mod-perl2 \
        libapache2-mod-perl2-dev \
        libcgi-pm-perl \
        liblocal-lib-perl \
        libpq-dev \
        libdbd-pg-perl \
        libmcrypt-dev \
        libldap2-dev \
        libldb-dev \
        libicu-dev \
        libgmp-dev \
        cpanminus \
        libexpat1-dev \
        libssl-dev \
        mysql-client \
        libmysqlclient-dev \
        libapreq2-dev \
        zip && \
        cpanm DBD::mysql && \
        cpanm DBD::ODBC && \
        a2enmod cgid && \
        a2enmod rewrite && \
        a2dissite 000-default && \
        chmod 755 /bin/init_container.sh \
                && echo "root:14HachI4" | chpasswd \
                && echo "cd /home" >> /etc/bash.bashrc \
                && ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \
                && ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so \
                && ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h \
                && rm -rf /var/lib/apt/lists/* \
RUN   \
   rm -f /var/log/apache2/* \
        && rmdir /var/lock/apache2 \
        && rmdir /var/run/apache2 \
        && rmdir /var/log/apache2 \
        && chmod 777 /var/log \
        && chmod 777 /var/run \
        && chmod 777 /var/lock \
        && chmod 777 /bin/init_container.sh \
        && cp /bin/apache2.conf /etc/apache2/apache2.conf \
        && rm -rf /var/www/html \
        && rm -rf /var/log/apache2 \
        && mkdir -p /home/LogFiles \
        && ln -s /home/site/wwwroot /var/www/html \
        && ln -s /home/LogFiles /var/log/apache2
RUN { \
        echo 'opcache.memory_consumption=128'; \
        echo 'opcache.interned_strings_buffer=8'; \
        echo 'opcache.max_accelerated_files=4000'; \
        echo 'opcache.revalidate_freq=60'; \
        echo 'opcache.fast_shutdown=1'; \
        echo 'opcache.enable_cli=1'; \
    } > /usr/local/etc/php/conf.d/opcache-recommended.ini
RUN { \
        echo 'error_log=/var/log/apache2/php-error.log'; \
        echo 'display_errors=Off'; \
        echo 'log_errors=On'; \
        echo 'display_startup_errors=Off'; \
        echo 'date.timezone=Asia/Tokyo'; \
    } > /usr/local/etc/php/conf.d/php.ini
# Perl symboliclink
RUN ln -sf /usr/bin/perl /usr/local/bin/perl
# set up OpenSSL and ports for SSH
ENV SSH_PASSWD "root:14HachI4"
RUN apt-get update \
        && apt-get install -y --no-install-recommends dialog \
        && apt-get update \
        && apt-get install -y --no-install-recommends openssh-server \
        && echo "$SSH_PASSWD" | chpasswd
RUN rm -f /etc/ssh/sshd_config
COPY sshd_config /etc/ssh/
ENV SSH_PORT 2222
RUN sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
RUN service ssh start
EXPOSE 2222 8080
ENV APACHE_RUN_USER www-data
ENV PHP_VERSION 5.6.21
ENV PORT 8080
ENV WEBSITE_ROLE_INSTANCE_ID localRoleInstance
ENV WEBSITE_INSTANCE_ID localInstance
ENV PATH ${PATH}:/home/site/wwwroot
WORKDIR /var/www/html
ENTRYPOINT ["/bin/init_container.sh"]
```