FROM node:18.19.0 as builder WORKDIR /app ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true RUN apt-get update && apt-get install -y g++ make python3 COPY ./package.json . COPY ./yarn.lock . COPY ./tsconfig.json . COPY ./.prettierrc . COPY ./.eslintrc . COPY ./readabilityjs/package.json ./packages/readabilityjs/package.json COPY ./api/package.json ./packages/api/package.json COPY ./text-to-speech/package.json ./packages/text-to-speech/package.json COPY ./content-handler/package.json ./packages/content-handler/package.json COPY ./liqe/package.json ./packages/liqe/package.json RUN yarn config set registry https://registry.npm.taobao.org && yarn install --pure-lockfile ADD ./readabilityjs ./packages/readabilityjs ADD ./api ./packages/api ADD ./text-to-speech ./packages/text-to-speech ADD ./content-handler ./packages/content-handler ADD ./liqe ./packages/liqe RUN yarn workspace @omnivore/text-to-speech-handler build RUN yarn workspace @omnivore/content-handler build RUN yarn workspace @omnivore/liqe build RUN yarn workspace @omnivore/api build # After building, fetch the production dependencies RUN rm -rf /app/packages/api/node_modules RUN rm -rf /app/node_modules RUN yarn install --pure-lockfile --production FROM node:18.19.0 as runner RUN apt-get update && apt-get install -y netcat-openbsd WORKDIR /app ENV NODE_ENV production ENV NODE_OPTIONS=--max-old-space-size=4096 ENV PORT=8080 COPY --from=builder /app/packages/api/dist /app/packages/api/dist COPY --from=builder /app/packages/readabilityjs/ /app/packages/readabilityjs/ COPY --from=builder /app/packages/api/package.json /app/packages/api/package.json COPY --from=builder /app/packages/api/node_modules /app/packages/api/node_modules COPY --from=builder /app/node_modules /app/node_modules COPY --from=builder /app/package.json /app/package.json COPY --from=builder /app/packages/text-to-speech/ /app/packages/text-to-speech/ COPY --from=builder /app/packages/content-handler/ /app/packages/content-handler/ COPY --from=builder /app/packages/liqe/ /app/packages/liqe/ EXPOSE 8080 CMD ["yarn", "workspace", "@omnivore/api", "start"]