43 lines
1.5 KiB
Docker
43 lines
1.5 KiB
Docker
FROM node:20 AS base
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
WORKDIR /app
|
|
RUN corepack enable && corepack prepare pnpm@9.5.0 --activate
|
|
|
|
FROM base AS build
|
|
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/
|
|
COPY ./packages/scout/pnpm-lock.yaml ./packages/scout/package.json ./packages/scout/
|
|
COPY ./packages/storage/pnpm-lock.yaml ./packages/storage/package.json ./packages/storage/
|
|
COPY ./packages/types/pnpm-lock.yaml ./packages/types/package.json ./packages/types/
|
|
COPY ./packages/utils/pnpm-lock.yaml ./packages/utils/package.json ./packages/utils/
|
|
|
|
## Install npm packages
|
|
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
|
|
|
|
## Copy package code into docker context
|
|
COPY ./packages/image/ ./packages/image/
|
|
COPY ./packages/scout/ ./packages/scout/
|
|
COPY ./packages/storage/ ./packages/storage/
|
|
COPY ./packages/types/ ./packages/types/
|
|
COPY ./packages/utils/ ./packages/utils/
|
|
|
|
RUN ls -la ./packages/image
|
|
|
|
## Transpile TS into JS
|
|
RUN pnpm --filter=@futureporn/image build
|
|
|
|
## Deploy (copy all production code into one place)
|
|
RUN pnpm deploy --filter=scout --prod /prod/scout
|
|
|
|
FROM base AS scout
|
|
COPY --from=build /prod/scout .
|
|
RUN ls -la .
|
|
ENTRYPOINT ["pnpm", "start"]
|
|
|