FROM node:18-alpine as base FROM base AS builder ARG APP_DIR=/opt/bridge RUN mkdir -p ${APP_DIR}/ RUN npm i -g turbo WORKDIR ${APP_DIR} COPY . . RUN turbo prune --scope=bridge-worker --docker FROM base AS installer ARG APP_DIR=/opt/bridge WORKDIR ${APP_DIR} COPY .gitignore .gitignore COPY --from=builder ${APP_DIR}/out/json/ . COPY --from=builder ${APP_DIR}/out/package-lock.json ./package-lock.json COPY --from=builder ${APP_DIR}/out/full/ . RUN npm ci RUN npm i -g turbo RUN turbo run build --filter=bridge-worker FROM graphile/worker:0.16.5 as runner ARG APP_DIR=/opt/bridge RUN mkdir -p ${APP_DIR}/ ARG BUILD_DIR=${APP_DIR}/apps/bridge-worker/build/main RUN mkdir -p ${APP_DIR}/ WORKDIR /worker COPY --from=installer ${BUILD_DIR}/lib ${APP_DIR}/lib COPY --from=installer ${BUILD_DIR}/tasks ${APP_DIR}/tasks COPY --from=installer ${APP_DIR}/apps/bridge-worker/graphile.config.prod.js ./graphile.config.js COPY --from=installer ${APP_DIR}/node_modules ${APP_DIR}/node_modules COPY --from=installer ${APP_DIR}/package.json ${APP_DIR}/package.json