11# This container should represent the benchmark server who is not dockerised
2- # So everything is installed into one container
2+ # So everything is installed into one container
33FROM ubuntu:18.04
44
55COPY --from=composer /usr/bin/composer /usr/local/bin/composer
6- # Copy benchmark kit source code
7- COPY bin/console /var/benchmark-kit/bin/console
8- COPY config /var/benchmark-kit/config
9- COPY documentation /var/benchmark-kit/documentation
10- COPY public /var/benchmark-kit/public
11- COPY src /var/benchmark-kit/src
12- COPY templates /var/benchmark-kit/templates
13- COPY vendor /var/benchmark-kit/vendor
14- COPY .env /var/benchmark-kit/.env
15- COPY changelog.md /var/benchmark-kit/changelog.md
16- COPY README.md /var/benchmark-kit/README.md
17- COPY phpbenchkit.sh /var/benchmark-kit/phpbenchkit.sh
18- # Configure nginx default page
19- COPY docker/html /var/www/html
20- COPY docker/nginx/default /etc/nginx/sites-available
216
227RUN \
23- # Update and instal some dependencies
8+ # Update and instal some dependencies
249 apt-get update \
2510 && apt-get upgrade -y \
2611 && apt-get install -y \
6146 && echo "phpbenchmarks ALL=(ALL) NOPASSWD: /usr/sbin/service php7.2-fpm restart" >> /etc/sudoers.d/phpbenchmarks \
6247 && echo "phpbenchmarks ALL=(ALL) NOPASSWD: /usr/sbin/service php7.3-fpm restart" >> /etc/sudoers.d/phpbenchmarks \
6348 && echo "phpbenchmarks ALL=(ALL) NOPASSWD: /usr/sbin/service php7.4-fpm restart" >> /etc/sudoers.d/phpbenchmarks \
64- # We have some commands to do in this directories with phpbenchmarks user.
65- # So instead of adding a lot of commands into sudoers, and as security doesn't matter in this container,
66- # change this directories mod to 777
67- && mkdir /var/benchmark-kit/var \
6849 && chmod -R 777 \
6950 /etc/nginx/sites-enabled \
7051 /var/log/nginx \
7455 /etc/php/7.2/fpm/conf.d \
7556 /etc/php/7.3/fpm/conf.d \
7657 /etc/php/7.4/fpm/conf.d \
77- /var/benchmark-kit/public \
78- /var/benchmark-kit/var \
7958 # Create phpbenchmarks user, we assume final host user id will be 1000 (should be it 99% of the time)
8059 && useradd -ms /bin/bash --uid 1000 phpbenchmarks \
8160 && usermod -a -G www-data phpbenchmarks \
@@ -93,14 +72,40 @@ RUN \
9372 && sed -i 's/group = www-data/group = phpbenchmarks/g' /etc/php/7.3/fpm/pool.d/www.conf \
9473 && sed -i 's/user = www-data/user = phpbenchmarks/g' /etc/php/7.4/fpm/pool.d/www.conf \
9574 && sed -i 's/group = www-data/group = phpbenchmarks/g' /etc/php/7.4/fpm/pool.d/www.conf \
96- # Define PHP 7.4 as default
75+ # Define PHP 7.4 as default
9776 && /usr/bin/update-alternatives --set php /usr/bin/php7.4 \
9877 # Remove nginx default page
9978 && rm /var/www/html/index.nginx-debian.html
10079
101- # Install git alone, or it will ask some geographical configs, I don't know why
80+ # Install git alone, or it will ask some geographical configs, I don't know why
10281RUN apt-get install -y git
10382
83+ # Copy benchmark kit source code
84+ COPY bin/console /var/benchmark-kit/bin/console
85+ COPY config /var/benchmark-kit/config
86+ COPY documentation /var/benchmark-kit/documentation
87+ COPY public /var/benchmark-kit/public
88+ COPY src /var/benchmark-kit/src
89+ COPY templates /var/benchmark-kit/templates
90+ COPY vendor /var/benchmark-kit/vendor
91+ COPY .env /var/benchmark-kit/.env
92+ COPY changelog.md /var/benchmark-kit/changelog.md
93+ COPY README.md /var/benchmark-kit/README.md
94+ COPY phpbenchkit.sh /var/benchmark-kit/phpbenchkit.sh
95+ # Configure nginx default page
96+ COPY docker/html /var/www/html
97+ COPY docker/nginx/default /etc/nginx/sites-available
98+
99+ # Configure benchmark kit directories
100+ RUN \
101+ mkdir /var/benchmark-kit/var \
102+ # We have some commands to do in this directories with phpbenchmarks user.
103+ # So instead of adding a lot of commands into sudoers, and as security doesn't matter in this container,
104+ # change this directories mod to 777
105+ && chmod -R 777 \
106+ /var/benchmark-kit/public \
107+ /var/benchmark-kit/var
108+
104109COPY --chown=phpbenchmarks docker/entrypoint.sh /usr/local/bin/entrypoint
105110COPY docker/phpbenchkit.sh /usr/local/bin/phpbenchkit
106111
0 commit comments