internal-freight-app/Dockerfile
2026-06-08 12:07:33 +00:00

45 lines
No EOL
1.2 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 (needed by some npm packages)
RUN apk add --no-cache git
WORKDIR /app
# Copy package files
COPY package.json package-lock.json* ./
# Install dependencies
RUN npm install
# Copy source files
COPY . .
# Build the production bundle (Vite substitutes env vars at build time)
ARG VITE_SUPABASE_URL
ARG VITE_SUPABASE_ANON_KEY
ENV VITE_SUPABASE_URL=${VITE_SUPABASE_URL}
ENV VITE_SUPABASE_ANON_KEY=${VITE_SUPABASE_ANON_KEY}
ENV NODE_ENV=production
RUN npm run build
# DEBUG: Verify build output
RUN echo "=== BUILD OUTPUT ===" && \
ls -la /app/dist && \
cat /app/dist/index.html | head -n 5 || echo "ERROR: index.html missing"
# ---------------------------------------------------------
# Production stage nginx static server
# ---------------------------------------------------------
FROM nginx:alpine
# Copy custom nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy the compiled React app
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]