Add debug output to Dockerfile to verify build success

This commit is contained in:
Vivek 2026-06-08 10:12:44 +00:00
parent 3fb81019b4
commit fb8ccbb237
2 changed files with 20 additions and 11 deletions

View file

@ -1,39 +1,38 @@
# --------------------------------------------------------- # ---------------------------------------------------------
# ---------------------------------------------------------
# Build stage # Build stage
# --------------------------------------------------------- # ---------------------------------------------------------
FROM node:18-alpine AS builder FROM node:18-alpine AS builder
# Install dependencies # Install git (only needed for npm postinstall scripts)
RUN apk add --no-cache git RUN apk add --no-cache git
WORKDIR /app WORKDIR /app
# Copy package files # Copy package files
COPY package.json ./ COPY package.json ./
# Install dependencies
RUN npm install RUN npm install
# Copy source files # Copy the rest of the source tree
COPY . . COPY . .
# Build the Vite production bundle # Build the production bundle (Vite outputs to `dist/`)
ENV NODE_ENV=production ENV NODE_ENV=production
RUN npm run build RUN npm run build
# DEBUG: Confirm build output exists before proceeding
RUN echo "=== BUILD OUTPUT CHECK ===" && \
ls -la /app/dist && \
cat /app/dist/index.html 2>/dev/null | head -n 5 || echo "ERROR: INDEX NOT FOUND - build may have failed silently"
# --------------------------------------------------------- # ---------------------------------------------------------
# Production stage tiny static server # Production stage tiny static server (nginx)
# --------------------------------------------------------- # ---------------------------------------------------------
FROM nginx:alpine FROM nginx:alpine
# Copy only our custom config
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy built assets
COPY --from=builder /app/dist /usr/share/nginx/html COPY --from=builder /app/dist /usr/share/nginx/html
# Expose port (Coolify expects 80 by default)
EXPOSE 80 EXPOSE 80
# Start nginx in foreground
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

10
vite.config.ts Normal file
View file

@ -0,0 +1,10 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
build: {
outDir: 'dist',
sourcemap: false,
},
});