Skip to content

Commit f3d4e41

Browse files
author
Chaminda Mahendra
committed
Initial commit for centos 7 docker image with PHP 7.4 integrated.
1 parent 94ab37e commit f3d4e41

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#only ment for develpoment
2+
FROM centos:7
3+
MAINTAINER chaminda@thinkcube.com
4+
5+
RUN yum clean all
6+
7+
WORKDIR /var/www/html
8+
9+
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys BF357DD4 \
10+
&& curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64" \
11+
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64.asc" \
12+
&& gpg --verify /usr/local/bin/gosu.asc \
13+
&& rm /usr/local/bin/gosu.asc \
14+
&& chmod 4755 /usr/local/bin/gosu
15+
16+
RUN yum install epel-release http://rpms.remirepo.net/enterprise/remi-release-7.rpm \
17+
http://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-4-x86_64.rpm -y && yum clean all
18+
19+
RUN sed -i "0,/enabled=0/{s/enabled=0/enabled=1/}" /etc/yum.repos.d/remi.repo \
20+
&& sed -i "0,/enabled=0/{s/enabled=0/enabled=1/}" /etc/yum.repos.d/remi-php74.repo
21+
22+
RUN yum install -y httpd mod_ssl php php-devel php-gd php-bcmath php-intl php-mcrypt php-mbstring php-process php-pdo php-mysqlnd php-xml php-pecl-zendopcache \
23+
php-pear php-pecl-mongodb php-pecl-couchbase2 php-phpunit-PHPUnit composer vim wget git bash-completion zeromq zeromq-devel php-pecl-zmq unzip && yum clean all
24+
25+
RUN echo "IncludeOptional vhost.d/*.conf" >> /etc/httpd/conf/httpd.conf \
26+
&& sed -i "s|User apache|User user|" /etc/httpd/conf/httpd.conf \
27+
&& sed -i "s|Group apache|Group user|" /etc/httpd/conf/httpd.conf \
28+
&& sed -i "s|#ServerName www.example.com:80|ServerName server|" /etc/httpd/conf/httpd.conf \
29+
&& sed -i "s|Options Indexes FollowSymLinks|Options FollowSymLinks|" /etc/httpd/conf/httpd.conf \
30+
&& sed -i 's/^\([^#]\)/#\1/g' /etc/httpd/conf.d/welcome.conf
31+
32+
RUN sed -i "s|;date.timezone =|date.timezone = Asia/Colombo|" /etc/php.ini
33+
34+
RUN useradd --shell /bin/bash -u 1000 -o -c "" -m user \
35+
&& usermod -aG apache,root user
36+
37+
RUN sed -i "1ialias ls='ls --color'" /home/user/.bashrc \
38+
&& sed -i "2ialias apachectl='gosu root httpd'" /home/user/.bashrc \
39+
&& sed -i "3ialias yum='gosu root yum'" /home/user/.bashrc
40+
41+
RUN chmod 770 /var/log/httpd
42+
43+
COPY index.php /var/www/html/index.php
44+
45+
VOLUME ["/etc/httpd/vhost.d", "/var/www/html", "/etc/httpd/conf", "/etc/httpd/conf.d", "/etc/httpd/ssl"]
46+
47+
EXPOSE 80 443
48+
49+
COPY run.sh /run.sh
50+
51+
CMD ["/run.sh"]

index.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
5+
<?php
6+
phpinfo();
7+
?>
8+
9+
</body>
10+
</html>

run.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
export HOME=/home/user
4+
5+
/usr/local/bin/gosu root /bin/chmod 750 /var/run/httpd/
6+
/usr/local/bin/gosu root /bin/chmod 750 /run/httpd/
7+
/usr/local/bin/gosu root /bin/rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd*
8+
9+
/usr/local/bin/gosu root /sbin/httpd -D FOREGROUND

0 commit comments

Comments
 (0)