Skip to content

Instantly share code, notes, and snippets.

@neonxp
Last active March 16, 2019 01:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neonxp/298117a809fb38ad920c to your computer and use it in GitHub Desktop.
Save neonxp/298117a809fb38ad920c to your computer and use it in GitHub Desktop.
Docker for PHP 5.3 project
app:
build: code/.
ports:
- 8080:80
volumes:
- ./code/www:/var/www
environment:
XDEBUG_CONFIG: "remote_host=172.17.0.1"
FROM ubuntu:12.04
MAINTAINER Alexander Kiryukhin <alexander@kiryukhin.su>
RUN apt-get update
RUN apt-get -y upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install apache2 libapache2-mod-php5 php5-mysql php5-gd php-pear php-apc php5-curl curl lynx-cur php5-xdebug php5-memcached memcached wget
RUN a2enmod php5
RUN a2enmod rewrite
# Update the Apaches PHP.ini file, enable <? ?> tags and quieten logging.
RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php5/apache2/php.ini
RUN sed -i "s/display_errors = Off/display_errors = On/" /etc/php5/apache2/php.ini
RUN sed -i "s/;sendmail_path =/sendmail_path = \/usr\/bin\/fakemail\.sh/" /etc/php5/apache2/php.ini
RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php5/apache2/php.ini
# Update the CLI PHP.ini file, enable <? ?> tags and quieten logging.
RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php5/cli/php.ini
RUN sed -i "s/display_errors = Off/display_errors = On/" /etc/php5/cli/php.ini
RUN sed -i "s/;sendmail_path =/sendmail_path = \/usr\/bin\/fakemail\.sh/" /etc/php5/cli/php.ini
RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php5/cli/php.ini
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
EXPOSE 80
RUN echo "zend_extension=/usr/lib/php5/20090626/xdebug.so" > /etc/php5/apache2/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /etc/php5/apache2/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /etc/php5/apache2/conf.d/xdebug.ini
RUN echo "zend_extension=/usr/lib/php5/20090626/xdebug.so" > /etc/php5/cli/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /etc/php5/cli/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /etc/php5/cli/conf.d/xdebug.ini
ADD apache-config.conf /etc/apache2/sites-enabled/000-default
ADD fakemail.sh /usr/bin/fakemail.sh
RUN wget https://phar.phpunit.de/phpunit-old.phar
RUN chmod +x phpunit-old.phar
RUN mv phpunit-old.phar /usr/local/bin/phpunit
CMD /usr/sbin/apache2ctl -D FOREGROUND
#!/bin/sh
prefix="/var/www/mail/new"
numPath="/var/www/mail"
if [ ! -f $numPath/num ]; then
echo "0" > $numPath/num
fi
num=`cat $numPath/num`
num=$(($num + 1))
echo $num > $numPath/num
name="$prefix/letter_$num.eml"
while read line
do
echo $line >> $name
done
chmod 777 $name
sed -i 's/Content\-Transfer\-Encoding\: base64/Content\-Transfer\-Encoding\: 8bit/' $name
/bin/true
@Grom-S
Copy link

Grom-S commented Nov 19, 2018

You should place the "apache-config.conf" file here as well..
Otherwise can't build the image because of this line

ADD apache-config.conf /etc/apache2/sites-enabled/000-default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment