wpackagist icon indicating copy to clipboard operation
wpackagist copied to clipboard

Installer not running in Dockerfiles.

Open sylvain-sonnen opened this issue 11 months ago • 1 comments

Hi guys,

I can't seem to make this work, I can't to find the right combo:

I have the following composer.json:

{
  "name": "vendor_name/wordpress",
  "description": "description",
  "minimum-stability": "stable",
  ],
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org",
      "only": [
        "wpackagist-plugin/*",
        "wpackagist-theme/*"
      ]
    }
  ],
  "require": {
    "php": ">= 8.2",
    "johnpbloch/wordpress": "6.4.3",
    "wpackagist-plugin/wp-graphql": "1.16.0"
  },
  "config": {
    "allow-plugins": {
      "johnpbloch/wordpress-core-installer": true,
      "composer/installers": true
    }
  },
  "extra": {
    "installer-paths": {
      "wordpress/wp-content/plugins/{$name}/": [
        "type:wordpress-plugin"
      ],
      "wordpress/wp-content/themes/{$name}/": [
        "type:wordpress-theme"
      ]
    }
  }
}

and this Dockerfile

FROM composer:latest AS composer
WORKDIR /app
COPY . ./
RUN composer install --ignore-platform-reqs --no-interaction --quiet --optimize-autoloader --no-dev

There is already a plugin in /wordpress/wp-content/plugins and a theme in ./wordpress/wp-content/themes.

When I docker build, Wordpress gets installed in the ./wordpress folder correctly. However all the plugins that existed before are gone and the one specified in the composer.json file are not there (the remain in the /vendor and re not processed)

If I run composer install locally, it behaves as expected.

Any clue what step I am missing?

Cheers.

sylvain-sonnen avatar Mar 12 '24 10:03 sylvain-sonnen

Hey @sylvain-sonnen, I think this will be hard to work out without knowing more about the project structure – volume mounts etc.

I'm pretty sure I have successfully used Wpackagist in Docker with existing, hard-coded plugins in the installer-paths alongside the Wpackagist ones.

As far as your Wpackagist plugin install goes, the first thing I'd try is removing --ignore-platform-reqs --no-interaction --quiet so you get more output and get some more assurance that your system is compatible with the packages you're asking for – at least the non-WordPress ones.

NoelLH avatar Mar 13 '24 16:03 NoelLH