| 1234567891011121314151617181920212223242526272829303132333435 |
- FROM node:alpine AS builder
- WORKDIR /www/backend
- # 切换阿里云源
- RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories && \
- apk update && \
- apk add --no-cache tzdata # 时区
- COPY . .
- RUN pwd && ls -la
- #
- RUN yarn install --production=false
- RUN yarn build
- RUN pwd && ls -la
- FROM node:alpine AS runner
- WORKDIR /www/backend
- ENV TZ=Asia/Shanghai
- ENV NODE_ENV=production
- ENV APP_PATH=/usr/src/app
- ENV DEBUG=moka:*
- # 时区
- COPY --from=builder /usr/share/zoneinfo/${TZ} /etc/localtime
- COPY --from=builder /www/backend/package.json /www/backend/yarn.lock ./
- RUN yarn install
- COPY --from=builder /www/backend/dist ./dist/
- COPY --from=builder /www/backend/config ./config/
- RUN pwd && ls -la
- EXPOSE 3000
- CMD yarn start 2>&1 | tee ./runtime/app.log
|