-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
71 lines (53 loc) · 2.66 KB
/
Dockerfile
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
FROM ubuntu:16.04
LABEL maintainer="Lakshmi Narasimhan <[email protected]>"
ENV UBUNTU_RELEASE=xenial \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
DEBIAN_FRONTEND=noninteractive \
ACCEPT_EULA=y \
HOME=/opt/app-root/src
LABEL io.k8s.description="Base image for Ubuntu based Drupal 8" \
io.k8s.display-name="OpenShift Drupal 8" \
io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" \
io.openshift.expose-services="8080:http" \
io.openshift.tags="builder, Nginx, php-fpm, php-7.1, Drupal 8"
RUN apt-get update && apt-get install -y nginx \
&& apt-get install -y locales \
&& locale-gen en_US.UTF-8 \
&& apt-get -y install software-properties-common python-software-properties \
&& add-apt-repository -y ppa:ondrej/php && apt-get update \
&& apt-get -y install php7.1 php7.1-fpm php7.1-cli php7.1-common php7.1-curl \
php7.1-mbstring php7.1-soap php7.1-xml php7.1-zip php7.1-memcached php7.1-mysql php7.1-gd php7.1-opcache \
wget libfreetype6-dev libjpeg-dev libpng-dev mysql-client curl gettext unzip git \
&& apt-get -y remove --purge software-properties-common python-software-properties \
&& apt-get -y autoremove && apt-get -y autoclean && apt-get clean && rm -rf /var/lib/apt/lists /tmp/* /var/tmp/*
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
COPY ./s2i/bin/ /usr/libexec/s2i
RUN mkdir -p /opt/app-root/etc/nginx && \
chown -R 1001:0 /opt/app-root/etc/nginx
COPY ./files/nginx.conf /etc/nginx/
COPY ./files/drupal.template /opt/app-root/etc/nginx
# code permissions
RUN useradd -u 1001 -r -g 0 -d ${HOME} -s /sbin/nologin -c "Default Application User" default \
&& mkdir -p ${HOME} \
&& chown -R 1001:0 ${HOME} && chmod -R g+rwX ${HOME}
RUN chown -R 1001:0 /usr/share/nginx
RUN chown -R 1001:0 /var/log && chmod -R g+rwX /var/log
RUN chown -R 1001:0 /var/lib/nginx && chmod -R g+rwX /var/lib/nginx
RUN chown -R 1001:0 /var/run && chmod -R g+rwX /var/run
RUN chown -R 1001:0 /etc/nginx && chmod -R g+rwX /etc/nginx
RUN sed -i \
-e "s/;listen.allowed_clients = 127.0.0.1/listen.allowed_clients = 127.0.0.1/g" \
-e "s/listen = \/run\/php\/php7.1-fpm.sock/listen = 127.0.0.1:9000/g" \
/etc/php/7.1/fpm/pool.d/www.conf
RUN echo "clear_env=false" >> /etc/php/7.1/fpm/pool.d/www.conf
RUN sed -i \
-e "s/mysqli.default_socket =/mysqli.default_socket = \/var\/lib\/mysql\/mysql.sock/g" \
-e "s/pdo_mysql.default_socket=/ pdo_mysql.default_socket=\/var\/lib\/mysql\/mysql.sock/g" \
/etc/php/7.1/fpm/php.ini
WORKDIR ${HOME}
EXPOSE 8080
USER 1001
CMD ["/usr/libexec/s2i/usage"]