FROM node:20 # Create app directory WORKDIR /usr/src/app # Install app dependencies # A wildcard is used to ensure both package.json AND package-lock.json are copied # where available (npm@5+) COPY package*.json ./ RUN npm install # If you are building your code for production # RUN npm ci --only=production # Bundle app source COPY . . RUN apt-get -y update RUN apt install wget # PNG ,JPG ,Tiff & WebP support # Consider adding more support with testing https://gist.github.com/hurricup/e14ae5bc47705fca6b1680e7a1fb6580 RUN apt install -y libjpeg-dev RUN apt install -y libpng-dev RUN apt install -y libtiff-dev RUN apt install -y libwebp-dev # Install HEIF support (libheic-dev Package does not exist on 16.04) RUN apt-get -y install libde265-dev RUN apt-get -y install pkg-config m4 libtool automake autoconf RUN wget https://github.com/strukturag/libheif/archive/v1.18.0.tar.gz RUN tar -xvf v1.18.0.tar.gz WORKDIR /usr/src/app/libheif-1.18.0/ RUN ./autogen.sh RUN ./configure RUN make RUN make install WORKDIR /usr/src/app # Install ruby 2.3.0 for ImageMagick RUN apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev RUN apt-get -y install wget && apt-get install -y ruby-full && ruby -v # Install ImageMagick # RUN apt-get install imagemagick -y # # Install ImageMagick with WEBP and HEIC support RUN wget https://download.imagemagick.org/archive/releases/ImageMagick-7.1.1-35.tar.xz RUN tar -xvf ImageMagick-7.1.1-35.tar.xz WORKDIR /usr/src/app/ImageMagick-7.1.1-35/ RUN ./configure --with-heic=yes --with-webp=yes RUN make RUN make install RUN ldconfig /usr/local/lib RUN identify --version RUN apt-get update && apt-get install -y \ ghostscript \ graphicsmagick \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app RUN npm run build RUN npm install pm2 -g EXPOSE 8000 CMD [ "pm2-runtime", "ecosystem.config.js" ]