FROM node:16

RUN npm config set registry https://registry.npm.taobao.org \
    && npm config set disturl https://npm.taobao.org/dist \
    && npm config set electron_mirror https://npm.taobao.org/mirrors/electron/ \
    && npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ \
    && npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/

RUN npm install cnpm -g

RUN npm cache clear --force

RUN export NODE_OPTIONS=--openssl-legacy-provider


WORKDIR /wwwroot

# 2. 只有部分文件如 package.json 发生变更的时候，才重新执行 npm install
COPY package.json .
COPY package-lock.json .
RUN npm install
RUN cnpm install

#COPY . .
#RUN npm run build

ENV TZ="Asia/Shanghai"

EXPOSE 3000

