This tutorial will help you for building image Docker that is installed Apache/HTTPD 2.4, PHP-FPM 7.4 and PHP Composer on Amazon Linux system
# Get base image
FROM amazonlinux:latest
# Author
MAINTAINER "ZeroBlog"
#update and install initscripts
RUN yum update -y && yum install -y initscripts;
#install apache
RUN yum install -y httpd && yum install -y amazon-linux-extras
#install PHP
RUN amazon-linux-extras enable php7.4
RUN yum clean metadata && yum install php-cli php-xml php-json php-mbstring php-process php-common php-fpm php-zip php-mysqlnd php-memcached -y
#config virtualhost
ADD ./apache/zeroblog.conf /etc/httpd/conf.d/zeroblog.conf
#install composer php
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#enable php-fpm start when start container
RUN systemctl enable php-fpm
#enable apache start when start container
RUN systemctl enable httpd
#copy code from cold to htdoc
ADD ./code /var/www/html
#add crontab script
#ADD crontab /etc/cron.d/zeroblog
#set doc root
WORKDIR /var/www/zeroblog
ENTRYPOINT ["/sbin/init"]
EXPOSE 80 443
0 Comments