Closed Kwadz closed 4 years ago
For example, if I add RUN printenv
just before ENTRYPOINT ["/docker-entrypoint.sh"]
in Dockerfile, I can read all the env vars that are passed via ENV
in Dockerfile but I can't see PHP_XDEBUG_REMOTE_HOST
while you've been able to use it just after in docker-entrypoint.sh
.
How did you make it possible?
In Drush’s implementation, the env vars are brought into the container via docker-compose.yml
Yes, it's exactly what I do and wodby does. The thing is you won't have this vars present during the image creation, as I mentioned:
I can read all the env vars that are passed via ENV in Dockerfile but I can't see
PHP_XDEBUG_REMOTE_HOST
I have it visible with printenv
only after a first restart of the container.
My docker-compose.yml
:
version: "3"
services:
php:
build:
context: .
environment:
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
DB_HOST: $DB_HOST
DB_USER: $DB_USER
DB_PASSWORD: $DB_PASSWORD
DB_NAME: $DB_NAME
PHP_FPM_USER: wodby
PHP_FPM_GROUP: wodby
# Read instructions at https://wodby.com/docs/stacks/php/local/#xdebug
PHP_XDEBUG: 1
PHP_XDEBUG_DEFAULT_ENABLE: 1
PHP_XDEBUG_REMOTE_CONNECT_BACK: 0
PHP_IDE_CONFIG: serverName=my-ide
PHP_XDEBUG_IDEKEY: "my-ide"
PHP_XDEBUG_REMOTE_HOST: 10.254.254.254 # macOS
volumes:
- ./:/var/www/html
So, I'm wondering how it is possible that wodby use them during image creation in docker-entrypoint.sh
for config files generation from templates.
Looks you're expecting this env vars at image build time but they are for container start only
Good catch @andypost! I had in my Dockerfile:
RUN ["/docker-entrypoint.sh"]
while wodby uses:
ENTRYPOINT ["/docker-entrypoint.sh"]
The first is executed during image build while the second at the container start.
First of all, thank you for this amazing PHP dockerisation! 👏
I noticed that the env vars are used to create ini files from templates. However I didn't see any ARG and ENV values in Dockefile, for example for
PHP_XDEBUG_REMOTE_HOST
used indocker-php-ext-xdebug.ini.tmpl#L38
.How come you're able to get this env vars available in Dockerfile (when executing docker-entrypoint.sh), without using ARG and ENV?