FROM node:16-alpine
COPY fastify-demo-*.tgz /home/
RUN npm config set registry http://mirrors.cloud.tencent.com/npm/
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN tar -xzvf /home/fastify-demo-1.0.0.tgz -C /home
RUN npm i -g pm2
EXPOSE 3000
ENV NODE_ENV development
WORKDIR /home/package
CMD ["pm2-runtime", "src/server.js", "-i", "5"]
Dockerfile 配置文件: