-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.rhel7
85 lines (71 loc) · 3.74 KB
/
Dockerfile.rhel7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
FROM rhscl/s2i-base-rhel7
# This image provides an Apache+PHP environment for running PHP
# applications.
EXPOSE 8080
ENV PHP_VERSION=5.6 \
PATH=$PATH:/opt/rh/rh-php56/root/usr/bin
ENV SUMMARY="Platform for building and running PHP $PHP_VERSION applications" \
DESCRIPTION="PHP $PHP_VERSION available as docker container is a base platform for \
building and running various PHP $PHP_VERSION applications and frameworks. \
PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers \
to write dynamically generated web pages. PHP also offers built-in database integration \
for several commercial and non-commercial database management systems, so writing \
a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding \
is probably as a replacement for CGI scripts."
LABEL summary="$SUMMARY" \
description="$DESCRIPTION" \
io.k8s.description="$DESCRIPTION" \
io.k8s.display-name="Apache 2.4 with PHP 5.6" \
io.openshift.expose-services="8080:http" \
io.openshift.tags="builder,php,php56,rh-php56" \
name="rhscl/php-56-rhel7" \
com.redhat.component="rh-php56-docker" \
version="5.6" \
release="3"
# Install Apache httpd and PHP
# We need to call 2 (!) yum commands before being able to enable repositories properly
# This is a workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1479388
#rh-php56-php-pecl-mongo
RUN yum repolist > /dev/null && \
yum install -y yum-utils && \
yum-config-manager --disable \* &> /dev/null && \
yum-config-manager --enable rhel-server-rhscl-7-rpms && \
yum-config-manager --enable rhel-7-server-rpms && \
yum-config-manager --enable rhel-7-server-optional-rpms && \
INSTALL_PKGS="rh-php56 rh-php56-php rh-php56-php-mysqlnd rh-php56-php-pgsql rh-php56-php-bcmath \
rh-php56-php-gd rh-php56-php-intl rh-php56-php-ldap rh-php56-php-mbstring rh-php56-php-pdo \
rh-php56-php-pecl-memcache rh-php56-php-process rh-php56-php-soap rh-php56-php-opcache rh-php56-php-xml \
rh-php56-php-pecl-xdebug rh-php56-php-gmp rh-php56-php-pear" && \
yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
yum clean all -y
# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH
COPY ./s2i/bin/ $STI_SCRIPTS_PATH
# Copy extra files to the image.
COPY ./root/ /
# In order to drop the root user, we have to make some directories world
# writeable as OpenShift default security model is to run the container under
# random UID.
RUN sed -i -f /opt/app-root/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \
sed -i '/php_value session.save_path/d' /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php56-php.conf && \
head -n151 /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf | tail -n1 | grep "AllowOverride All" || exit && \
echo "IncludeOptional /opt/app-root/etc/conf.d/*.conf" >> /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \
mkdir /tmp/sessions && \
chown -R 1001:0 /opt/app-root /tmp/sessions && \
chmod -R a+rwx /tmp/sessions && \
chmod -R ug+rwx /opt/app-root && \
chmod -R a+rwx /etc/opt/rh/rh-php56 && \
chmod -R a+rwx /opt/rh/httpd24/root/var/run/httpd && \
chmod -R a+rwx /usr/libexec/s2i/assemble && \
chmod -R a+rwx $STI_SCRIPTS_PATH/usage && \
chmod -R a+rwx $STI_SCRIPTS_PATH/assemble && \
chmod -R a+rwx $STI_SCRIPTS_PATH/run
#RUN pecl install mongodb \
# && docker-php-ext-enable mongodb
RUN pecl install mongodb
RUN echo "extension=mongodb.so" | tee /etc/opt/rh/rh-php56/php.ini
USER 1001
# Set the default CMD to print the usage of the language image
CMD $STI_SCRIPTS_PATH/usage && \
$STI_SCRIPTS_PATH/assemble && \
$STI_SCRIPTS_PATH/run