Commit 877ac367 by Ali Arshad

updated Dockerfile

parent 9095b064
Pipeline #182 passed with stage
in 0 seconds
FROM ubuntu:latest FROM aliarshad/apf:latest
#################################################### Adding new user and group #################################################### #################################################### Adding new user and group ####################################################
ENV myuser=jenkins ENV myuser=ali
ENV myuserid=1002 ENV myuserid=501
ENV mygroup=jenkins ENV mygroup=ali
ENV mygroupid=1002 ENV mygroupid=501
RUN groupadd $mygroup -g $mygroupid RUN groupadd $mygroup -g $mygroupid
RUN useradd -u $myuserid -g $mygroupid $myuser RUN useradd -u $myuserid -g $mygroupid $myuser
###################################################### Update APT #######################################################
RUN apt-get update -y
###################################################### Utilities #######################################################
#install git curl wget zip unzip nano
RUN apt-get install -y git curl wget zip unzip nano && \
apt-get -y clean all
######################################################### Apache #########################################################
RUN apt-get install -y apache2 && \
apt-get -y clean all
######################################################### PHP #########################################################
RUN apt-get install -y php7.0-fpm php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0-xml php7.0 libapache2-mod-fastcgi && \
apt-get -y clean all
######################################################### Apache Configs ######################################################### ######################################################### Apache Configs #########################################################
## Enabling Mod_Rewrite
RUN a2enmod actions fastcgi
RUN a2enmod rewrite
RUN a2enmod headers
RUN a2enmod expires
RUN a2enmod deflate
## Fixing localhost error.
RUN echo "ServerName localhost" >> /etc/apache2/conf-available/servername.conf
RUN a2enconf servername
RUN rm /etc/apache2/sites-enabled/000-default.conf
RUN echo "<VirtualHost *:80> \n\
ServerAdmin webmaster@localhost \n\
DocumentRoot /var/www/html \n\
\n\
ErrorLog ${APACHE_LOG_DIR}/error.log \n\
CustomLog ${APACHE_LOG_DIR}/access.log combined \n\
\n\
<Directory /var/www/html> \n\
Options Indexes FollowSymLinks MultiViews \n\
AllowOverride All \n\
Order allow,deny \n\
allow from all \n\
</Directory> \n\
<IfModule mod_fastcgi.c> \n\
AddHandler php7-fcgi .php \n\
Action php7-fcgi /php7-fcgi \n\
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi \n\
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /run/php/php7.0-fpm.sock -pass-header Authorization \n\
<FilesMatch '.+\.ph(p[345]?|t|tml)$'> \n\
SetHandler php7-fcgi \n\
</FilesMatch> \n\
<Directory '/usr/lib/cgi-bin'> \n\
Require all granted \n\
</Directory> \n\
</IfModule> \n\
</VirtualHost>" >> /etc/apache2/sites-enabled/000-default.conf
RUN x=";clear_env = no" && y="clear_env = no" && sed -i -e "s/$x/$y/g" /etc/php/7.0/fpm/pool.d/www.conf RUN x=";clear_env = no" && y="clear_env = no" && sed -i -e "s/$x/$y/g" /etc/php/7.0/fpm/pool.d/www.conf
#################################################### php should run as my user #################################################### #################################################### php should run as my user ####################################################
RUN x="user = www-data" && y="user = $myuser" && sed -i -e "s/$x/$y/g" /etc/php/7.0/fpm/pool.d/www.conf RUN x="user = www-data" && y="user = $myuser" && sed -i -e "s/$x/$y/g" /etc/php/7.0/fpm/pool.d/www.conf
...@@ -81,4 +21,4 @@ RUN chmod u+x /start.sh ...@@ -81,4 +21,4 @@ RUN chmod u+x /start.sh
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["/start.sh"] ENTRYPOINT ["/start.sh"]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment