gulp-imagemin error with optipng command failed issue only in docker

Viewed 198

I get command failed: /app/node_modules/optipng-bin/vendor/optipng --version issue while building on docker. I don't get issue when I run it locally though. I looked into several resources where it says to download imagemin-optipng or fix using npm rebuild. I have tried both but still not working

here is the docker file and gulp file

FROM node:16.14


ENV NODE_ENV=dev
ENV app /app

RUN mkdir $app && \
    apt-get update && \
        apt-get install -y build-essential gcc make apache2-utils \
    nginx

WORKDIR $app
ADD . $app
EXPOSE 80
ENTRYPOINT ["sh", "start.sh"]

start.sh

npm cache clean -f
npm start

package.json

"prestart": "npm install",
"start": "gulp --dev"

gulpfile.js

import imagemin from "gulp-imagemin"; // "8.0.0"
import imageminOptipng from 'imagemin-optipng'; // "^8.0.0"


gulp.task("favicon", () => {
  return gulp.src("src/favicon.ico").pipe(gulp.dest(config.dest));
});

// images
gulp.task("images", gulp.series("favicon", () => {
  return gulp
    .src(config.images.toolkit.src)
    .pipe(imagemin(
      [imageminOptipng({ optimizationLevel: 2 }),]
    ))
    .pipe(gulp.dest(config.images.toolkit.dest));
}));

enter image description here

0 Answers
Related