# Stage 1: NOTE: context is actually ../
FROM node:15.12.0-alpine AS sources

RUN apk --no-cache add yarn git
  
WORKDIR /app

ADD ./qmi-cloud-worker ./
ADD ./qmi-cloud-common ../qmi-cloud-common

RUN yarn install --production

# Stage 2: 
FROM node:15.12.0-alpine AS production
WORKDIR /app
COPY --from=sources /app ./

CMD ["node", "-r", "esm", "index.js"]