Fix Docker build: copy SDK into node_modules directly for Turbopack compat
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0e05f3a5ab
commit
6666cd1182
20
Dockerfile
20
Dockerfile
|
|
@ -12,18 +12,24 @@ COPY encryptid-sdk /encryptid-sdk/
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN npm ci || npm install
|
RUN npm ci || npm install
|
||||||
|
|
||||||
# Copy source files, then restore node_modules
|
# Ensure SDK is properly linked in node_modules
|
||||||
COPY rvote-online/ .
|
RUN rm -rf node_modules/@encryptid/sdk && \
|
||||||
RUN rm -rf node_modules .next
|
mkdir -p node_modules/@encryptid && \
|
||||||
|
cp -r /encryptid-sdk node_modules/@encryptid/sdk
|
||||||
|
|
||||||
# Re-install to get clean node_modules with SDK resolved
|
# Copy source files (exclude node_modules/.next from source)
|
||||||
RUN npm ci || npm install
|
COPY rvote-online/ /tmp/rvote-src/
|
||||||
|
RUN cp -r /tmp/rvote-src/src ./src && \
|
||||||
|
cp -r /tmp/rvote-src/public ./public 2>/dev/null || true && \
|
||||||
|
cp /tmp/rvote-src/next.config.ts /tmp/rvote-src/tsconfig.json /tmp/rvote-src/postcss.config.mjs /tmp/rvote-src/tailwind.config.ts /tmp/rvote-src/eslint.config.mjs /tmp/rvote-src/components.json ./ 2>/dev/null || true && \
|
||||||
|
cp /tmp/rvote-src/middleware.ts ./ 2>/dev/null || true && \
|
||||||
|
rm -rf /tmp/rvote-src
|
||||||
|
|
||||||
# Generate Prisma client
|
# Generate Prisma client
|
||||||
RUN npx prisma generate
|
RUN npx prisma generate
|
||||||
|
|
||||||
# Build the application (use webpack - Turbopack has issues with file: linked subpath exports)
|
# Build the application
|
||||||
RUN npx next build --no-turbopack
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM node:20-alpine AS runner
|
FROM node:20-alpine AS runner
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue