FROM node:18.16.0-buster-slim

WORKDIR /data/srv/

ENV TZ Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

COPY package*.json ./

RUN npm set registry <https://registry.npmmirror.com>

RUN npm_config_sharp_binary_host="<https://npmmirror.com/mirrors/sharp>" npm_config_sharp_libvips_binary_host="<https://npmmirror.com/mirrors/sharp-libvips>" npm install sharp

RUN npm install \\
    && npm install pm2 -g

COPY . ./

RUN npm run build

# RUN apt-get update \\
#     && apt-get -y install procps \\
#     && apt-get install -y vim

EXPOSE 3000

CMD ["pm2-runtime", "ecosystem.config.js"]