2024-07-18 18:42:54 +00:00
|
|
|
FROM node:20 AS base
|
2024-07-12 14:41:34 +00:00
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
|
|
WORKDIR /app
|
2024-07-18 18:42:54 +00:00
|
|
|
RUN corepack enable && corepack prepare pnpm@9.5.0 --activate
|
2024-07-12 14:41:34 +00:00
|
|
|
|
2024-07-18 18:42:54 +00:00
|
|
|
FROM base AS build
|
2024-07-16 06:57:27 +00:00
|
|
|
WORKDIR /app
|
|
|
|
RUN mkdir -p /app/packages/scout && mkdir /app/packages/taco && mkdir -p /prod/scout
|
|
|
|
|
|
|
|
## Copy manfiests, lockfiles, and configs into docker context
|
|
|
|
COPY package.json pnpm-lock.yaml .npmrc .
|
|
|
|
COPY ./packages/image/pnpm-lock.yaml ./packages/image/package.json ./packages/image/
|
2024-07-16 10:46:44 +00:00
|
|
|
COPY ./packages/scout/pnpm-lock.yaml ./packages/scout/package.json ./packages/scout/
|
2024-07-16 06:57:27 +00:00
|
|
|
COPY ./packages/storage/pnpm-lock.yaml ./packages/storage/package.json ./packages/storage/
|
|
|
|
COPY ./packages/temporal-workflows/pnpm-lock.yaml ./packages/temporal-workflows/package.json ./packages/temporal-workflows/
|
|
|
|
COPY ./packages/temporal-worker/pnpm-lock.yaml ./packages/temporal-worker/package.json ./packages/temporal-worker/
|
2024-07-16 10:46:44 +00:00
|
|
|
COPY ./packages/types/pnpm-lock.yaml ./packages/types/package.json ./packages/types/
|
|
|
|
COPY ./packages/utils/pnpm-lock.yaml ./packages/utils/package.json ./packages/utils/
|
2024-07-16 06:57:27 +00:00
|
|
|
|
|
|
|
## Install npm packages
|
2024-07-16 10:46:44 +00:00
|
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm fetch
|
|
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --recursive --frozen-lockfile --prefer-offline
|
2024-07-16 06:57:27 +00:00
|
|
|
|
|
|
|
## Copy package code into docker context
|
|
|
|
COPY ./packages/image/ ./packages/image/
|
2024-07-12 14:41:34 +00:00
|
|
|
COPY ./packages/scout/ ./packages/scout/
|
2024-07-16 10:46:44 +00:00
|
|
|
COPY ./packages/storage/ ./packages/storage/
|
2024-07-14 05:20:35 +00:00
|
|
|
COPY ./packages/temporal-workflows/ ./packages/temporal-workflows/
|
|
|
|
COPY ./packages/temporal-worker/ ./packages/temporal-worker/
|
2024-07-16 10:46:44 +00:00
|
|
|
COPY ./packages/types/ ./packages/types/
|
|
|
|
COPY ./packages/utils/ ./packages/utils/
|
2024-07-16 06:57:27 +00:00
|
|
|
|
2024-07-18 18:42:54 +00:00
|
|
|
RUN ls -la ./packages/image
|
|
|
|
|
2024-07-16 10:46:44 +00:00
|
|
|
## Transpile TS into JS
|
2024-07-18 18:42:54 +00:00
|
|
|
RUN pnpm --filter=@futureporn/image build
|
2024-07-16 10:46:44 +00:00
|
|
|
RUN pnpm --filter=@futureporn/temporal-workflows build
|
|
|
|
RUN pnpm --filter=!@futureporn/temporal-workflows -r build
|
2024-07-16 06:57:27 +00:00
|
|
|
|
|
|
|
## Deploy (copy all production code into one place)
|
2024-07-12 14:41:34 +00:00
|
|
|
RUN pnpm deploy --filter=scout --prod /prod/scout
|
|
|
|
|
2024-07-18 18:42:54 +00:00
|
|
|
FROM base AS scout
|
2024-07-12 14:41:34 +00:00
|
|
|
COPY --from=build /prod/scout .
|
2024-07-16 10:46:44 +00:00
|
|
|
RUN ls -la .
|
2024-07-12 14:41:34 +00:00
|
|
|
ENTRYPOINT ["pnpm", "start"]
|
|
|
|
|