Replies: 2 comments 6 replies
-
|
First a question for you: For FROM ubuntu AS test_non_interactive
RUN apt-get update && apt-get install -y php unzip libbz2-dev gcc make autoconf bison re2c pkg-config libtool php-dev
COPY --from=build_pie_phar /app/pie.phar /usr/local/bin/pie
RUN mkdir /foo
WORKDIR /foo
RUN echo '{"require":{"php":"~8.3.0","ext-mongodb":"~2.1","ext-redis":"~6.1"}}' >> /foo/composer.json
RUN echo '{"_readme":["This file locks the dependencies of your project to a known state","Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies","This file is @generated automatically"],"content-hash":"201d95d4413cb1f999fba94555181bb0","packages":[],"packages-dev":[],"aliases":[],"minimum-stability":"stable","stability-flags":{},"prefer-stable":false,"prefer-lowest":false,"platform":{"php":"~8.3.0","ext-mongodb":"~2.1","ext-redis":"~6.1"},"platform-dev":{},"plugin-api-version":"2.6.0"}' >> /foo/composer.lock
RUN pie install --allow-non-interactive-project-install
RUN pie showAnd this successfully installs the two missing extensions: In this particular instance, it However, yes; if there is more than one extension (maybe there is an extension not given in your example) that provides the This is definitely something I'd like to improve on, but we need to find an effective way for PIE users to say "when I want |
Beta Was this translation helpful? Give feedback.
-
|
Are there already any ideas how to finally solve this? I created an issue for that with a possible solution: In my opinion there must be some mappings to the specific extensions (not "just* for security reasons...), if you want to implement such non-interactive mode (required for building images) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
So far we used PECL and are now trying to replace it with Pie, but having some issues with automating it.
Just as a short background, due to our container structure we're at first building a base image and afterwards using that as a base to build more granular images for different purposes (e.g. app and cron). But they share the same PHP setup and to avoid redundant work and time, PHP is already installed in the base image. For now that was quite simple and we could simply use
pecl install+docker-php-ext-enableto install and enable our PHP extensions like e.g. mongodb and redis. They were part of the base image and by that the setup was equal for all subsequent images. Next to that, build dependencies are deleted at the end of the build to keep the images smaller and the final containers are of course running as www-data so only the build has root permissions.Of course we already use composer to install dependencies as well, so we already have them defined in the composer.json like
Having the setup given, we tried to use Pie in a similar way and hit an issue with this non interactive approach.
Of course we could use Pie with hardcoded packages in the Dockerfile like:
(Installing multiple extensions at once is not yet possible, but there's already a feature request for it: #466)
But we're more in favor of relying on the composer.json integration to avoid defining the extensions twice, cause for Composer they are anyways already defined. So just calling:
And here's our issue, the resolution of
ext-*to a package name is always triggering a prompt.Even with
--allow-non-interactive-project-installor--no-interactionthe prompt remains (which is quite understandable, cause how should Pie be sure about which package is correct, except just using the suggested one automatically)The only location we could determine where this mapping is persisted is the
pie.lockin/root/.pie/php8.4_d2b6f37be78b1b629f281b53efb060b9/pie.lockbut of course it's not designed to be modified.So, the final question, is there any way to use Pie in a fully non interactive way, using the composer.json as a source?
At least I couldn't find anything in the documentation nor the command help.
The only working but unsafe way to achieve it, by automatically accepting option 1 of the prompts, seems to be currently
Beta Was this translation helpful? Give feedback.
All reactions