fp/d.worker.dockerfile

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 install
COPY pnpm-lock.yaml .npmrc package.json .
COPY ./packages/types/ ./packages/types/
COPY ./packages/storage/ ./packages/storage/
COPY ./packages/scout/ ./packages/scout/
COPY ./packages/image/ ./packages/image/
COPY ./packages/utils/ ./packages/utils/
COPY ./packages/temporal-worker/ ./packages/temporal-worker/
COPY ./packages/temporal-workflows/ ./packages/temporal-workflows/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --recursive --frozen-lockfile --prefer-offline
FROM install AS build
RUN pnpm -r build
RUN pnpm deploy --filter=temporal-worker --prod /prod/temporal-worker
# FROM base as build
# RUN mkdir -p /prod/worker
# COPY pnpm-workspace.yaml package.json pnpm-lock.yaml .npmrc .
# COPY ./packages/temporal-workflows/pnpm-lock.yaml ./packages/temporal-workflows/
# COPY ./packages/temporal-worker/pnpm-lock.yaml ./packages/temporal-worker/
# # RUN pnpm fetch
# RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --recursive --frozen-lockfile --prefer-offline
# COPY ./packages/temporal-workflows/ ./packages/temporal-workflows/
# COPY ./packages/temporal-worker/ ./packages/temporal-worker/
# RUN ls -la .
# RUN ls -la ./packages
# RUN ls -la ./packages/temporal-workflows
# RUN pnpm -r build
# RUN pnpm deploy --filter=temporal-worker --prod /prod/worker
FROM base as worker
COPY --from=build /prod/temporal-worker .
RUN ls -la ./
ENTRYPOINT ["pnpm", "start"]