Almost hostable from monorepo
This commit is contained in:
@@ -10,6 +10,8 @@ WORKDIR /app
|
||||
|
||||
# Copy package + whichever Bun lock file you have (optional)
|
||||
COPY package.json bun.lockb* bun.lock* ./
|
||||
COPY tsconfig.base.json ./
|
||||
COPY apps/next/package.json ./apps/next/
|
||||
|
||||
# If bun.lockb exists, enforce frozen; otherwise install and generate it
|
||||
RUN if [ -f bun.lockb ]; then \
|
||||
@@ -22,7 +24,10 @@ RUN if [ -f bun.lockb ]; then \
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
COPY --from=deps /app/tsconfig.base.json ./tsconfig.base.json
|
||||
COPY apps/next ./apps/next
|
||||
COPY packages ./packages
|
||||
WORKDIR /app/apps/next
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN bun run build
|
||||
|
||||
@@ -34,13 +39,12 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# non-root user
|
||||
RUN addgroup -S nodejs -g 1001 && adduser -S nextjs -u 1001
|
||||
COPY --from=builder /app/public ./public
|
||||
RUN mkdir .next && chown -R nextjs:nodejs .next
|
||||
COPY --from=builder /app/apps/next/public ./public
|
||||
RUN mkdir -p .next/cache && chown -R nextjs:nodejs .next
|
||||
|
||||
# Next standalone output
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
COPY --from=builder /app/apps/next/.next/standalone ./
|
||||
COPY --from=builder /app/apps/next/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
|
Reference in New Issue
Block a user