Skip to content

Commit

Permalink
Added wget ack make gcc-c gcc-c++ to php-fpm images (make and gcc-c++…
Browse files Browse the repository at this point in the history
… are required for #169)
  • Loading branch information
davidalger committed Jun 26, 2020
1 parent 389c913 commit 1e0577b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions images/php-fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ENV MAILHOG_HOST mailhog
ENV MAILHOG_PORT 1025

RUN yum install -y which pv sudo bind-utils python36-pip mariadb102 bash-completion rsync socat oathtool \
wget ack make gcc-c gcc-c++ \
&& yum clean all \
&& rm -rf /var/cache/yum

Expand Down

3 comments on commit 1e0577b

@ihor-sviziev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidalger maybe it's better to create separate image for shopware, as for instance make and gcc isn't needed for m2 installations. What do you thing?

@davidalger
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ihor-sviziev Definitely a good thought, and one I considered. However, when I stepped back and considered that make and a gcc build chain here are required for Shopware 6 due to some npm packages it uses, I felt it made sense to put these in the base php-fpm images since it's more of an npm requirement than a Shopware specific one, and a requirement which could easily need to be satisfied for for PWAs for any platform.

This is what NPM has to say about it's dependencies:

If a package references to another package with a git URL, npm depends on a preinstalled git.

If one of the packages npm tries to install is a native node module and requires compiling of C++ Code, npm will use node-gyp for that task. For a Unix system, node-gyp needs Python, make and a buildchain like GCC. On Windows, Python and Microsoft Visual Studio C++ are needed. Python 3 is not supported by node-gyp. For more information visit the node-gyp repository and the node-gyp Wiki.

Since you asked, I did a little research so I could followup here. This is the error one gets installing Shopware 6 if make and gcc-c++ are not present:

$  npm --prefix vendor/shopware/platform/src/Storefront/Resources/app/storefront/ clean-install
npm WARN prepare removing existing node_modules/ before installation

> fsevents@1.2.12 install /var/www/html/vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/@babel/cli/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 4.19.76-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/html/vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/@babel/cli/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v10.21.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

> fsevents@1.2.12 install /var/www/html/vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/fsevents
> node-gyp rebuild

gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 4.19.76-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/html/vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/fsevents
gyp ERR! node -v v10.21.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

Then I tried the same with PWA Studio. I.e. can I run yarn install without make and gcc present. Doing that resulted in the following in my output:

[3/5] Fetching packages...
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
...
[5/5] Building fresh packages...
[6/11] ⠁ node-zopfli-es
[-/11] ⠁ waiting...
[-/11] ⠁ waiting...
[4/11] ⠁ sharp
warning Error running install script for optional dependency: "/tmp/pwa-studio/node_modules/node-zopfli-es: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /tmp/pwa-studio/node_modules/node-zopfli-es
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@4.0.0
gyp info using node@10.21.0 | linux | x64
gyp http GET https://nodejs.org/download/release/v10.21.0/node-v10.21.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.21.0/node-v10.21.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v10.21.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v10.21.0/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/tmp/pwa-studio/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/pwa-studio/node_modules/node-zopfli-es/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/pwa-studio/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/www-data/.node-gyp/10.21.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/www-data/.node-gyp/10.21.0',
gyp info spawn args   '-Dnode_gyp_dir=/tmp/pwa-studio/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/www-data/.node-gyp/10.21.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/pwa-studio/node_modules/node-zopfli-es',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/tmp/pwa-studio/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/tmp/pwa-studio/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/tmp/pwa-studio/node_modules/which/which.js:80:29)
gyp ERR! stack     at /tmp/pwa-studio/node_modules/which/which.js:89:16
gyp ERR! stack     at /tmp/pwa-studio/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /tmp/pwa-studio/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 4.19.76-linuxkit
gyp ERR! command \"/usr/local/bin/node\" \"/tmp/pwa-studio/node_modules/node-zopfli-es/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /tmp/pwa-studio/node_modules/node-zopfli-es

So all that to say, it seems this is required by PWA Studio in it's current form, and given the need for the build chain components to install babel or fsevents (something babel uses) it'll be fairly common when modern frontend stacks are in play.

@davidalger
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case anyone else seeing this catches the typo in package names, gcc-c was corrected to gcc in commit fe195f4. :)

Please sign in to comment.