-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathDockerfile-php-5.4
58 lines (46 loc) · 2.12 KB
/
Dockerfile-php-5.4
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
FROM centos:7
WORKDIR /app
# Install httpd, PHP, node and required dependencies
RUN yum install wget git tar xz-utils httpd mod_ssl -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm && \
sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/remi-php54.repo && \
yum install -y php54 php54-php-mysql php54-php-mbstring php54-php-xml php54-php-gd php54-php-fpm php54-php-cli && \
wget -qO- https://nodejs.org/dist/v16.13.2/node-v16.13.2-linux-x64.tar.xz | tar -xJ
# Add php & node to path
ENV PATH="${PATH}:/opt/remi/php54/root/usr/bin:/opt/remi/php54/root/usr/sbin:/app/node-v16.13.2-linux-x64/bin"
# Clone SynchWeb - Change branch/repo as needed here
RUN git clone -b master https://github.com/DiamondLightSource/SynchWeb.git
# Copy config files and startup script
COPY httpd.conf /etc/httpd/conf/
COPY entrypoint.bash ./entrypoint.bash
COPY php-fpm.conf ./SynchWeb/
COPY php.ini ./SynchWeb/
COPY config.php ./SynchWeb/api/
# Copy SSL certificates
RUN mkdir /etc/pki/tls/certs/synchweb && \
mkdir /etc/pki/tls/private/synchweb
COPY cert.pem /etc/pki/tls/certs/synchweb/
COPY key.pem /etc/pki/tls/private/synchweb/
# Adjust file access permissions
RUN chmod 744 /etc/httpd/conf/httpd.conf && \
chmod 744 ./entrypoint.bash && \
chmod 766 ./SynchWeb/php-fpm.conf && \
chmod 766 ./SynchWeb/api/config.php
# Build Frontend
RUN cd SynchWeb/client/ && \
npm install && npm run build:dev && \
export HASH=$(ls -t /app/SynchWeb/client/dist | head -n1) && \
ln -sf dist/${HASH}/index.html index.php && \
rm -rf /app/node-v16.13.2-linux-x64
# Set access port
EXPOSE 8082
# Install Composer & Build Backend
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
rm ./composer-setup.php
# Note: the 'composer install' step is prone to fail - if this doesn't work
# add it to the entrypoint.bash script instead (uncommenting out the line there)
RUN cd SynchWeb/api/ && \
/usr/local/bin/composer install && \
rm /usr/local/bin/composer
# Set startup script
ENTRYPOINT ["/app/entrypoint.bash"]