I have a Dockerfile like the following in order to re-build the application in 2.4 and apply some CSS changes
>cat Dockerfile
# build stage
FROM cachethq/docker:latest
COPY public/img/login-logo.png /var/www/html/public/img/login-logo.png
COPY resources /var/www/html/resources
USER root
RUN apk add --no-cache npm
USER 1001
RUN mkdir -p /home/www-data/.npm/ && cd /var/www/html && npm install && npm run production
# docker stage
FROM cachethq/docker:latest
RUN rm -fr /var/www/html
COPY --from=0 --chown=1001 /var/www/html /var/www/html
COPY entrypoint.sh /sbin/entrypoint.sh
USER root
RUN apk add --no-cache vim
USER 1001
Lately I have noticed that uglify-js is giving this error.
DONE Compiled successfully in 30631ms 11:59:51 AM
Whoops! We had trouble minifying "public/dist/js/all.js". Perhaps you need to use mix.babel() instead?
/var/www/html/node_modules/laravel-mix/src/webpackPlugins/CustomTasksPlugin.js:64
throw e;
^
SyntaxError: Name expected
at JS_Parse_Error.get (eval at <anonymous> (/var/www/html/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:86:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cachet@ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cachet@ production script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/www-data/.npm/_logs/2020-12-22T11_59_51_992Z-debug.log
When I build the image using an older docker image from a previous build from my docker registry, that has node_modules already installed, then the build succeeds.
I have verified that the uglify-js is in the same version in both images.
However, if I diff the two folders (the one created in a new npm install, and the one that was installed in an older image) the actual files differ. So, as a workaround, after npm install I am replacing the node_modules/uglify-js from an older image to the node_modules and the npm run production works without any issues and this was my workaround to the problem.
I have a Dockerfile like the following in order to re-build the application in
2.4
and apply some CSS changesLately I have noticed that
uglify-js
is giving this error.When I build the image using an older docker image from a previous build from my docker registry, that has
node_modules
already installed, then the build succeeds. I have verified that theuglify-js
is in the same version in both images.However, if I diff the two folders (the one created in a new npm install, and the one that was installed in an older image) the actual files differ. So, as a workaround, after
npm install
I am replacing thenode_modules/uglify-js
from an older image to thenode_modules
and thenpm run production
works without any issues and this was my workaround to the problem.