mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
fix: Update Dockerfile.web to support Next.js .next directory output
- Check for both .next (Next.js) and dist (Vite/other) directories - Copy .next and public assets for Next.js builds - Fallback to dist directory for other build tools - Fixes build verification for @edr/passenger-backoffice Next.js app
This commit is contained in:
@@ -41,8 +41,9 @@ RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm turbo build --filter="${TURBO_
|
||||
exit 1)
|
||||
|
||||
# Verify build output exists before proceeding
|
||||
RUN if [ ! -d "/app/${APP_PATH}/dist" ]; then \
|
||||
echo "ERROR: Build output directory not found at /app/${APP_PATH}/dist"; \
|
||||
# Check for .next directory (Next.js) or dist directory (Vite/other)
|
||||
RUN if [ ! -d "/app/${APP_PATH}/.next" ] && [ ! -d "/app/${APP_PATH}/dist" ]; then \
|
||||
echo "ERROR: Build output directory not found at /app/${APP_PATH}/.next or /app/${APP_PATH}/dist"; \
|
||||
echo "Contents of /app/${APP_PATH}:"; \
|
||||
ls -la /app/${APP_PATH}/ 2>/dev/null || echo "Directory does not exist"; \
|
||||
exit 1; \
|
||||
@@ -51,6 +52,14 @@ RUN if [ ! -d "/app/${APP_PATH}/dist" ]; then \
|
||||
FROM nginx:alpine AS runner
|
||||
ARG APP_PATH
|
||||
COPY infrastructure/nginx/spa.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=builder /app/${APP_PATH}/dist /usr/share/nginx/html
|
||||
|
||||
# Copy Next.js build output if it exists
|
||||
RUN if [ -d "/app/${APP_PATH}/.next" ]; then \
|
||||
COPY --from=builder /app/${APP_PATH}/.next /usr/share/nginx/html/.next && \
|
||||
COPY --from=builder /app/${APP_PATH}/public /usr/share/nginx/html/public 2>/dev/null || true; \
|
||||
else \
|
||||
COPY --from=builder /app/${APP_PATH}/dist /usr/share/nginx/html; \
|
||||
fi
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
Reference in New Issue
Block a user