ludops-skeleton/Dockerfile

29 lines
767 B
Docker

FROM node:20-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
# Install dependencies
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
COPY apps/api/package.json ./apps/api/
COPY apps/web/package.json ./apps/web/
COPY packages/shared/package.json ./packages/shared/
RUN pnpm install --frozen-lockfile
# Copy source and build
COPY . .
RUN pnpm turbo run build
# Runner Stage
FROM node:20-alpine AS runner
WORKDIR /app
COPY --from=base /app/apps/api/dist ./api
COPY --from=base /app/apps/web/dist ./web-dist
COPY --from=base /app/node_modules ./node_modules
# We need the shared package built files if they exist
COPY --from=base /app/packages/shared ./packages/shared
EXPOSE 3000
CMD ["node", "api/index.js"]