I am struggling trying to dockerize an app for CakePHP 3. I already did with a PHP apache image but it is pretty big, for that reason I am trying to dockerize the app in an alpine container. I also need npm, but I cannot install npm, I have received a lot of errors during the build. After executing the container the "npm" command is "not found" either. This is the docker file I have:
FROM php:7.4-fpm-alpine
ARG ENV=development
ARG UID=1000
ARG HOST_OS=Linux
ENV APP_ENV=$ENV
ENV HOST_OS=$HOST_OS
RUN apk add --update nodejs-current npm
WORKDIR /var/www/html/webroot // The package.json is here.
# Setup GD extension
RUN apk add --no-cache \
bash \
curl \
supervisor \
freetype \
libjpeg-turbo \
libpng \
freetype-dev \
libzip-dev \
libjpeg-turbo-dev \
libpng-dev \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-enable gd \
&& apk del --no-cache \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
&& rm -rf /tmp/*
RUN npm install -g npm
RUN docker-php-ext-install pdo_mysql zip bcmath
The errors:
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
build/libtool.m4:561: _LT_AC_LOCK is expanded from...
build/libtool.m4:1184: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2727: _LT_AC_LANG_C_CONFIG is expanded from...
....... // I stoped here because there are more in red color.
UPDATE: The npm package is not installed, when I execute the container "npm -i" does not work, I can see "not found". I can install the package directly in the container, but it is not installed during the build.