Files
music-hub/Dockerfile.api
Robin Choice e7aa866332 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>
2026-04-12 20:09:08 +02:00

26 lines
966 B
Docker

FROM oven/bun:1 AS base
WORKDIR /app
FROM base AS install
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/api/node_modules ./apps/api/node_modules
COPY . .
FROM base AS production
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"]