FROM dockerhub.datagrand.com/ci_runner/frontend_web:4.0-taobao as builder

# git
COPY .ssh /root/.ssh
RUN chmod 600 /root/.ssh/id_rsa

# build
WORKDIR /app
ADD package.json /app/package.json
RUN cnpm i
# ADD yarn.lock /app/yarn.lock
# RUN yarn
ADD . /app
RUN yarn lint
RUN yarn test:ci
RUN yarn build
RUN yarn site:build
RUN rm -rf dist/*.js.map

# +++++++++++++++++++++++++++++++++++++++++++++++++++
FROM nginx:stable
RUN mkdir -p web/logs

COPY --from=builder app/src/dist/ /web/dist
ADD docker/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
