Turbopack only resolves tsconfig paths within the project root. Changed @shared/* from ../shared/* to ./shared/* in all tsconfigs. Docker copies shared/ into the project dir at build time. Local dev uses symlinks (gitignored). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
57 lines
1.3 KiB
Docker
57 lines
1.3 KiB
Docker
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY admin-lehrer/package.json admin-lehrer/package-lock.json* ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy source code + shared types (inside project for Turbopack)
|
|
COPY admin-lehrer/ .
|
|
COPY shared/ ./shared/
|
|
|
|
# Build arguments for environment variables
|
|
ARG NEXT_PUBLIC_API_URL
|
|
ARG NEXT_PUBLIC_OLD_ADMIN_URL
|
|
ARG NEXT_PUBLIC_KLAUSUR_SERVICE_URL
|
|
|
|
# Set environment variables for build
|
|
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
|
ENV NEXT_PUBLIC_OLD_ADMIN_URL=$NEXT_PUBLIC_OLD_ADMIN_URL
|
|
ENV NEXT_PUBLIC_KLAUSUR_SERVICE_URL=$NEXT_PUBLIC_KLAUSUR_SERVICE_URL
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:20-alpine AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
# Set to production
|
|
ENV NODE_ENV=production
|
|
|
|
# Create non-root user
|
|
RUN addgroup --system --gid 1001 nodejs
|
|
RUN adduser --system --uid 1001 nextjs
|
|
|
|
# Copy built assets
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
# Switch to non-root user
|
|
USER nextjs
|
|
|
|
# Expose port (internal port is 3000, mapped externally by docker-compose)
|
|
EXPOSE 3000
|
|
|
|
# Set hostname
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
# Start the application
|
|
CMD ["node", "server.js"]
|