internal-freight-app/Dockerfile

38 lines
No EOL
1.1 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ---------------------------------------------------------
# ---------------------------------------------------------
# Build stage
# ---------------------------------------------------------
FROM node:18-alpine AS builder
# Install git (only needed for npm postinstall scripts)
RUN apk add --no-cache git
WORKDIR /app
# Copy package files
COPY package.json ./
RUN npm install
# Copy the rest of the source tree
COPY . .
# Build the production bundle (Vite outputs to `dist/`)
ENV NODE_ENV=production
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 (nginx)
# ---------------------------------------------------------
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]