This developer needed to turn back the clock in the PHP-FPM container, you will not believe what he did next! (#1675)
* Added documentation for installing libfaketime in the php-fpm container * Enabled installing and using libfaketime system-wide inside the php-fpm container
This commit is contained in:
parent
1b865dd153
commit
89051de67d
|
@ -1499,10 +1499,33 @@ e) set it to `true`
|
||||||
3 - Set it to `true`
|
3 - Set it to `true`
|
||||||
<br>
|
<br>
|
||||||
4 - Re-build the containers `docker-compose build php-fpm`
|
4 - Re-build the containers `docker-compose build php-fpm`
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a name="Install-Faketime"></a>
|
||||||
|
## Install libfaketime in the php-fpm container
|
||||||
|
Libfaketime allows you to control the date and time that is returned from the operating system.
|
||||||
|
It can be used by specifying a special string in the `PHP_FPM_FAKETIME` variable in the `.env` file.
|
||||||
|
For example:
|
||||||
|
`PHP_FPM_FAKETIME=-1d`
|
||||||
|
will set the clock back 1 day. See (https://github.com/wolfcw/libfaketime) for more information.
|
||||||
|
|
||||||
|
1 - Open the `.env` file
|
||||||
|
<br>
|
||||||
|
2 - Search for the `PHP_FPM_INSTALL_FAKETIME` argument under the PHP-FPM container
|
||||||
|
<br>
|
||||||
|
3 - Set it to `true`
|
||||||
|
<br>
|
||||||
|
4 - Search for the `PHP_FPM_FAKETIME` argument under the PHP-FPM container
|
||||||
|
<br>
|
||||||
|
5 - Set it to the desired string
|
||||||
|
<br>
|
||||||
|
6 - Re-build the containers `docker-compose build php-fpm`<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="phpstorm-debugging"></a>
|
<a name="phpstorm-debugging"></a>
|
||||||
|
|
|
@ -144,6 +144,7 @@ services:
|
||||||
- INSTALL_IMAGE_OPTIMIZERS=${PHP_FPM_INSTALL_IMAGE_OPTIMIZERS}
|
- INSTALL_IMAGE_OPTIMIZERS=${PHP_FPM_INSTALL_IMAGE_OPTIMIZERS}
|
||||||
- INSTALL_IMAGEMAGICK=${PHP_FPM_INSTALL_IMAGEMAGICK}
|
- INSTALL_IMAGEMAGICK=${PHP_FPM_INSTALL_IMAGEMAGICK}
|
||||||
- INSTALL_CALENDAR=${PHP_FPM_INSTALL_CALENDAR}
|
- INSTALL_CALENDAR=${PHP_FPM_INSTALL_CALENDAR}
|
||||||
|
- INSTALL_FAKETIME=${PHP_FPM_INSTALL_FAKETIME}
|
||||||
volumes:
|
volumes:
|
||||||
- ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini
|
- ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini
|
||||||
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
|
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
|
||||||
|
@ -154,6 +155,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
|
- PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
|
||||||
- DOCKER_HOST=tcp://docker-in-docker:2375
|
- DOCKER_HOST=tcp://docker-in-docker:2375
|
||||||
|
- FAKETIME=${PHP_FPM_FAKETIME}
|
||||||
depends_on:
|
depends_on:
|
||||||
- workspace
|
- workspace
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -149,6 +149,8 @@ PHP_FPM_INSTALL_SWOOLE=false
|
||||||
PHP_FPM_INSTALL_PG_CLIENT=false
|
PHP_FPM_INSTALL_PG_CLIENT=false
|
||||||
PHP_FPM_INSTALL_PCNTL=false
|
PHP_FPM_INSTALL_PCNTL=false
|
||||||
PHP_FPM_INSTALL_CALENDAR=false
|
PHP_FPM_INSTALL_CALENDAR=false
|
||||||
|
PHP_FPM_INSTALL_FAKETIME=false
|
||||||
|
PHP_FPM_FAKETIME=-0
|
||||||
|
|
||||||
### PHP_WORKER ############################################
|
### PHP_WORKER ############################################
|
||||||
|
|
||||||
|
|
|
@ -485,6 +485,18 @@ RUN if [ ${INSTALL_CALENDAR} = true ]; then \
|
||||||
docker-php-ext-install calendar \
|
docker-php-ext-install calendar \
|
||||||
;fi
|
;fi
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# libfaketime:
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
ARG INSTALL_FAKETIME=false
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_FAKETIME} = true ]; then \
|
||||||
|
apt-get install -y libfaketime \
|
||||||
|
;fi
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# Check PHP version:
|
# Check PHP version:
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -509,6 +521,12 @@ RUN apt-get clean && \
|
||||||
|
|
||||||
RUN usermod -u 1000 www-data
|
RUN usermod -u 1000 www-data
|
||||||
|
|
||||||
|
# Adding the faketime library to the preload file needs to be done last
|
||||||
|
# otherwise it will preload it for all commands that follow in this file
|
||||||
|
RUN if [ ${INSTALL_FAKETIME} = true ]; then \
|
||||||
|
echo "/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1" > /etc/ld.so.preload \
|
||||||
|
;fi
|
||||||
|
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
CMD ["php-fpm"]
|
CMD ["php-fpm"]
|
||||||
|
|
Loading…
Reference in New Issue