Almost hostable from monorepo

This commit is contained in:
2025-09-12 17:21:38 -05:00
parent b1eae564be
commit 4d81e1f8e6
3 changed files with 13 additions and 8 deletions

View File

@@ -21,7 +21,8 @@
"plugins": [{ "name": "next" }], "plugins": [{ "name": "next" }],
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": ["./src/*"],
"~/*": ["../../packages/backend/*"]
} }
}, },
"include": [ "include": [

View File

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

View File

@@ -4,8 +4,8 @@ networks:
services: services:
techtracker-next: techtracker-next:
build: build:
context: ../../../apps/next/ context: ../../../
dockerfile: host/next/docker/Dockerfile dockerfile: ./host/next/docker/Dockerfile
image: ${CONTAINER_NAME}:alpine image: ${CONTAINER_NAME}:alpine
container_name: ${CONTAINER_NAME} container_name: ${CONTAINER_NAME}
env_file: [.env] env_file: [.env]