Image Creation Loses Environment Variables
The images created secondarily from the original source (FROM scratch as php-dev COPY --from=php-base . /) do not inherit the environment variables from the base. The file structure is the same, but other Docker set items such as ENV and ENTRYPOINT are not inherited.
ENV specifically causes an issue with compiling xdebug (or other php extensions) because the script for it expects PHP_INI_DIR=/usr/local/etc/php to exist.
For the php dev container, we might need to just add these environment variables if we cannot figure out a way to copy from a base image:
ENV PHP_INI_DIR /usr/local/etc/php
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi
ENV PHP_TIMEZONE America/New_York
ENV PHP_LDFLAGS -Wl,-O1 -Wl,--hash-style=both -pie
ENV PHP_CFLAGS -fstack-protector-strong -fpic -fpie -O2
ENV PHP_CPPFLAGS -fstack-protector-strong -fpic -fpie -O2
@smfsh Do you happen to know what is setting these environment variables in the php-base image to begin with?
First time I'm thinking about this issue but one option we might do is printenv into a file and then import that again after the move. Don't 100% know if it will work but I can test soon.
I this a solution to this will be important to make maintenance and expansion quicker and easier.