fp/d.boop.dockerfile

35 lines
1.2 KiB
Plaintext
Raw Normal View History

## boop is an example package showing how to include dependency workspace packages into the docker build
FROM node:20.15 as base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /usr/src/app
RUN corepack enable && corepack prepare pnpm@9.2.0 --activate
FROM base as build
# ENV NODE_ENV=development
# RUN mkdir -p /usr/src/app/packages/boop && mkdir /usr/src/app/packages/taco && mkdir -p /prod/boop
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc .
COPY ./packages/boop/pnpm-lock.yaml ./packages/boop/package.json ./packages/boop/
COPY ./packages/taco/pnpm-lock.yaml ./packages/taco/package.json ./packages/taco/
COPY ./packages/types/pnpm-lock.yaml ./packages/types/package.json ./packages/types/
# RUN pnpm fetch
# I think pnpm install is broken.
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --offline
COPY ./packages/boop/ ./packages/boop/
COPY ./packages/taco/ ./packages/taco/
COPY ./packages/types/ ./packages/types/
RUN echo "@@@@@@@@@@@@@@@@@@@@ show me the meat!"
RUN ls -lash ./
RUN ls -lash ./packages/boop
RUN pnpm -r build
RUN pnpm deploy --filter=boop --prod /prod/boop
FROM base as boop
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /prod/boop .
RUN ls -la .
ENTRYPOINT ["pnpm", "start"]