Files
bodyshop-media-server/Dockerfile
2024-09-06 17:23:11 -07:00

88 lines
2.5 KiB
Docker

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 -y update
RUN apt install -y wget
RUN apt install -y lsb-release curl gpg
RUN curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
RUN chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list
RUN apt update
RUN apt install -y redis
# 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 -y install libde265-dev
RUN apt -y install pkg-config m4 libtool automake autoconf cmake
RUN wget https://github.com/strukturag/libde265/archive/v1.0.15.tar.gz
RUN tar -xvf v1.0.15.tar.gz
WORKDIR /usr/src/app/libde265-1.0.15/
RUN cmake .
RUN make
RUN make install
RUN ./autogen.sh
RUN ./configure
WORKDIR /usr/src/app
RUN wget https://github.com/strukturag/libheif/archive/v1.18.2.tar.gz
RUN tar -xvf v1.18.2.tar.gz
WORKDIR /usr/src/app/libheif-1.18.2/
RUN cmake --preset=release .
RUN make
RUN make install
WORKDIR /usr/src/app
# Install ruby 2.3.0 for ImageMagick
RUN apt -y install -y build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
RUN apt -y 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-37.tar.xz
RUN tar -xvf ImageMagick-7.1.1-37.tar.xz
WORKDIR /usr/src/app/ImageMagick-7.1.1-37/
RUN ./configure --with-heic=yes --with-webp=yes
RUN make
RUN make install
RUN ldconfig /usr/local/lib
RUN identify --version
RUN apt update && apt 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 ["sh", "-c", "redis-server --daemonize yes && pm2-runtime ecosystem.config.cjs"]