module.exports = {
apps: [
{
script: 'dist/src/main.js',
watch: false,
instances: 1,
autorestart: true,
max_memory_restart: '4G',
env: { NODE_ENV: 'production' },
},
],
};
FROM node:16.15.1-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 config set registry <https://registry.npmmirror.com>
RUN npm config set sharp_binary_host "<https://npmmirror.com/mirrors/sharp>"
RUN npm config set sharp_libvips_binary_host "<https://npmmirror.com/mirrors/sharp-libvips>"
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
COPY ecosystem.config.js .
EXPOSE 3000
CMD ["pm2-runtime", "ecosystem.config.js"]