Fix Dockerfiles: include all workspace package.jsons for bun lockfile
The monorepo bun.lock references all workspaces. Previous Dockerfiles only copied a subset, causing frozen-lockfile install to fail. Now all package.jsons are copied. Also add curl + healthchecks to both images. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,11 +2,12 @@ FROM oven/bun:1 AS base
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS install
|
||||
COPY package.json bun.lock ./
|
||||
COPY package.json bun.lock turbo.json ./
|
||||
COPY packages/shared/package.json ./packages/shared/
|
||||
COPY packages/db/package.json ./packages/db/
|
||||
COPY apps/api/package.json ./apps/api/
|
||||
RUN bun install --frozen-lockfile --production
|
||||
COPY apps/web/package.json ./apps/web/
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
FROM base AS build
|
||||
COPY --from=install /app/node_modules ./node_modules
|
||||
@@ -16,8 +17,9 @@ COPY --from=install /app/apps/api/node_modules ./apps/api/node_modules
|
||||
COPY . .
|
||||
|
||||
FROM base AS production
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg curl && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=build /app .
|
||||
EXPOSE 3000
|
||||
ENV NODE_ENV=production
|
||||
HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl -f http://localhost:3000/health || exit 1
|
||||
CMD ["bun", "run", "apps/api/src/index.ts"]
|
||||
|
||||
@@ -2,23 +2,28 @@ FROM oven/bun:1 AS base
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS install
|
||||
COPY package.json bun.lock ./
|
||||
COPY package.json bun.lock turbo.json ./
|
||||
COPY packages/shared/package.json ./packages/shared/
|
||||
COPY packages/db/package.json ./packages/db/
|
||||
COPY apps/api/package.json ./apps/api/
|
||||
COPY apps/web/package.json ./apps/web/
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
FROM base AS build
|
||||
COPY --from=install /app/node_modules ./node_modules
|
||||
COPY --from=install /app/packages/shared/node_modules ./packages/shared/node_modules
|
||||
COPY --from=install /app/packages/db/node_modules ./packages/db/node_modules
|
||||
COPY --from=install /app/apps/web/node_modules ./apps/web/node_modules
|
||||
COPY . .
|
||||
RUN cd apps/web && bun run build
|
||||
|
||||
FROM base AS production
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=build /app/apps/web/build ./build
|
||||
COPY --from=build /app/apps/web/package.json .
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
EXPOSE 3000
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl -f http://localhost:3000/ || exit 1
|
||||
CMD ["bun", "./build/index.js"]
|
||||
|
||||
Reference in New Issue
Block a user