fp/d.meal.dockerfile

30 lines
1013 B
Docker

## meal 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 /app
RUN corepack enable && corepack prepare pnpm@9.5.0 --activate
FROM base AS build
# ENV NODE_ENV=development
# RUN mkdir -p /app/packages/meal && mkdir /app/packages/taco && mkdir -p /prod/meal
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc .
COPY ./packages/meal/pnpm-lock.yaml ./packages/meal/package.json ./packages/meal/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm fetch
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --offline
COPY ./packages/meal/ ./packages/meal/
RUN echo "@@@@@@@@@@@@@@@@@@@@ show me the meat!"
RUN ls -lash ./
RUN ls -lash ./packages/meal
RUN pnpm -r build
RUN pnpm deploy --filter=meal --prod /prod/meal
FROM base AS meal
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /prod/meal .
RUN ls -la .
ENTRYPOINT ["pnpm", "start"]