Ubuntu - Apache - PHP
Dockerfile (PHP 7.2 + sqlite)
FROM ubuntu:20.04
MAINTAINER Ahmad Fairus Nofianto
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Jakarta
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt update -y && apt upgrade -y && \
apt install apache2 telnet wget net-tools curl -y && \
apt install software-properties-common -y && \
add-apt-repository ppa:ondrej/php -y && \
apt install php7.2 -y && \
a2enmod php7.2 && \
apt install php7.2 php-pear php7.2-gd php7.2-dev php7.2-zip php7.2-mbstring php7.2-mysql php7.2-xml php7.2-curl -y
COPY custome.conf /etc/apache2/sites-available/custome.conf
RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf && \
a2dissite 000-default.conf && a2ensite custome.conf && \
mkdir -p /var/www/html && \
a2enmod rewrite && \
apt install sqlite3 php-sqlite3 -y && \
service apache2 restart && rm -f /var/www/html/index.html
WORKDIR /var/www/html
COPY index.php index.php
CMD ["apachectl", "-D", "FOREGROUND"]
Dockerfile (PHP 7.4 + sqlite)
FROM ubuntu:20.04
MAINTAINER Ahmad Fairus Nofianto
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Jakarta
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt update -y && apt upgrade -y && \
apt install apache2 telnet wget net-tools curl -y && \
apt install software-properties-common -y && \
add-apt-repository ppa:ondrej/php -y && \
apt install php7.4 -y && \
a2enmod php7.4 && \
apt install php7.4 php-pear php7.4-gd php7.4-dev \
php7.4-zip php7.4-mbstring php7.4-mysql php7.4-xml php7.4-curl php7.4-intl php7.4-bcmath -y
COPY custome.conf /etc/apache2/sites-available/custome.conf
RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf && \
a2dissite 000-default.conf && a2ensite custome.conf && \
mkdir -p /var/www/html && \
a2enmod rewrite && a2enmod ssl && a2enmod proxy && a2enmod headers && \
apt install sqlite3 php-sqlite3 -y && \
service apache2 restart && rm -f /var/www/html/index.html
WORKDIR /var/www/html
COPY index.php index.php
CMD ["apachectl", "-D", "FOREGROUND"]
Dockerfile (PHP 8.1 +sqlite)
FROM ubuntu:20.04
MAINTAINER Ahmad Fairus Nofianto
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Jakarta
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt update -y && apt upgrade -y && \
apt install apache2 telnet wget net-tools curl -y && \
apt install software-properties-common -y && \
add-apt-repository ppa:ondrej/php -y && \
apt install php8.1 -y && \
a2enmod php8.1 && \
apt install php8.1 php-pear php8.1-gd php8.1-dev \
php8.1-zip php8.1-mbstring php8.1-mysql php8.1-xml php8.1-curl php8.1-intl php8.1-bcmath -y
COPY custome.conf /etc/apache2/sites-available/custome.conf
RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf && \
a2dissite 000-default.conf && a2ensite custome.conf && \
mkdir -p /var/www/html && \
a2enmod rewrite && \
apt install sqlite3 php-sqlite3 -y && \
service apache2 restart && rm -f /var/www/html/index.html
WORKDIR /var/www/html
COPY index.php index.php
CMD ["apachectl", "-D", "FOREGROUND"]
Vhost File (custome.conf)
<VirtualHost *:80>
ServerName 127.0.0.1
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
File index.php
<?php
phpinfo();
?>
Comments 0