# build
FROM node:12-alpine
COPY . /root/website
WORKDIR /root/website
RUN yarn && yarn run build

# serve
FROM nginx:1.19.6-alpine
# setup timezone
RUN apk update && apk add tzdata sed bash
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' > /etc/timezone
RUN mkdir -p /root/logs /run/nginx/
# copy scripts
COPY container/*.sh /root/
RUN ls /root
COPY container/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=0 /root/website/dist /home/nginx/website
RUN /root/setup.sh
ENTRYPOINT /root/init.sh
