twn39 / code

:memo: 代码笔记,通过 issue 的方式记录日常遇到的问题和学习笔记
13 stars 1 forks source link

whistle docker file #399

Open twn39 opened 2 years ago

twn39 commented 2 years ago

Dockerfile:

FROM node:16-alpine
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 npm install -g whistle
RUN w2 i whistle.inspect
EXPOSE 8899
CMD ["w2", "run", "-M", "prod"]

CMD ["w2", "run", "-M", "prod"] 表示 whistle 以生产模式运行于前台,如果需要加认证可以添加参数:

CMD ["w2", "run", "-M", "prod", "-n", "{username}", "-w", "{password}"]

参考文档:http://wproxy.org/whistle/