260320:1149 Refactor Overrall #03 build failed with pnpm due to symlink structure incompatibility
Build and Deploy / deploy (push) Has been cancelled

This commit is contained in:
admin
2026-03-20 11:49:15 +07:00
parent 9a7c7f6cc4
commit 9166fa13be
2 changed files with 12 additions and 10 deletions
+10 -9
View File
@@ -60,8 +60,8 @@ RUN mkdir /n && ln -s /n .next && \
pnpm run build && \ pnpm run build && \
rm .next && mv /n .next rm .next && mv /n .next
# Verify standalone build was created # Verify build was created
RUN ls -la /w/frontend/.next/standalone/ || (echo "ERROR: Standalone build not found!" && exit 1) RUN ls -la /w/frontend/.next/ || (echo "ERROR: Build not found!" && exit 1)
# ========================= # =========================
@@ -80,15 +80,16 @@ ENV PORT=3000
RUN addgroup -g 1001 -S nextjs && \ RUN addgroup -g 1001 -S nextjs && \
adduser -S nextjs -u 1001 adduser -S nextjs -u 1001
# Install curl for healthcheck # Install curl and pnpm for healthcheck
RUN apk add --no-cache curl RUN apk add --no-cache curl && \
npm install -g pnpm@10.32.1
# Copy standalone output from build # Copy application and node_modules from build
COPY --from=build --chown=nextjs:nextjs /w/frontend/.next/standalone ./ COPY --from=build --chown=nextjs:nextjs /w/frontend ./
COPY --from=build --chown=nextjs:nextjs /w/frontend/.next/static ./.next/static COPY --from=build --chown=nextjs:nextjs /w/frontend/node_modules ./node_modules
# Debug: Verify files exist # Debug: Verify files exist
RUN ls -la ./ && ls -la ./.next/ && ls -la ./.next/static/ || (echo "ERROR: Required files not found!" && exit 1) RUN ls -la ./ && ls -la ./.next/ && ls -la ./node_modules/ || (echo "ERROR: Required files not found!" && exit 1)
USER nextjs USER nextjs
@@ -97,5 +98,5 @@ EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=60s \ HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=60s \
CMD curl -f http://localhost:3000/ || exit 1 CMD curl -f http://localhost:3000/ || exit 1
CMD ["node", "frontend/server.js"] CMD ["pnpm", "start"]
+2 -1
View File
@@ -4,7 +4,8 @@
const nextConfig = { const nextConfig = {
// 1. Standalone Output: จำเป็นสำหรับการ Deploy บน Docker (QNAP) // 1. Standalone Output: จำเป็นสำหรับการ Deploy บน Docker (QNAP)
// Next.js จะคัดแยกเฉพาะไฟล์ที่จำเป็นต้องใช้จริงออกมาไว้ในโฟลเดอร์ .next/standalone // Next.js จะคัดแยกเฉพาะไฟล์ที่จำเป็นต้องใช้จริงออกมาไว้ในโฟลเดอร์ .next/standalone
output: "standalone", // TEMPORARILY DISABLED: pnpm standalone build issues
// output: "standalone",
// 2. React Strict Mode: ช่วยดักจับ Bug ในช่วง Dev (เช่น Component render ซ้ำ) // 2. React Strict Mode: ช่วยดักจับ Bug ในช่วง Dev (เช่น Component render ซ้ำ)
reactStrictMode: true, reactStrictMode: true,