Contoh Dockerfile Server Debian Wheezy dengan PHP 5 dan Apache
Melanjutkan omongan tidak jelas saya soal setup development di tahun ini, agaknya berbagi file template Docker yang saya punya, sudah jadi keharusan (haha). Berikut adalah template server yang saya bikin, berbasis Debian Wheezy dengan aplikasi PHP dan Apache yang otomatis jalan.
[sourcecode]
FROM debian:wheezy
RUN apt-get update && \
apt-get install -y php5 php5-cli php5-gd php5-curl mysql-client php5-mysql libapache2-mod-php5 && \
apt-get install -y nano vim
RUN a2enmod rewrite
RUN a2enmod php5
COPY default.conf /etc/apache2/sites-available/default
RUN sed -ie 's/memory_limit\ =\ 128M/memory_limit\ =\ 2G/g' /etc/php5/apache2/php.ini
RUN sed -ie 's/\;date\.timezone\ =/date\.timezone\ =\ Asia\/Jakarta/g' /etc/php5/apache2/php.ini
RUN sed -ie 's/upload_max_filesize\ =\ 2M/upload_max_filesize\ =\ 200M/g' /etc/php5/apache2/php.ini
RUN sed -ie 's/post_max_size\ =\ 8M/post_max_size\ =\ 200M/g' /etc/php5/apache2/php.ini
EXPOSE 80
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
[/sourcecode]
Nah, selain dockerfile diatas, ada satu lagi file konfigurasi default apache yang harus ada satu lokasi dengan file ini. Contohnya:
[sourcecode]
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ErrorLog /var/www/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
[/sourcecode]
Sangat simple, Apache akan menggunakan folder /var/www sebagai direktori aktif.