Files
paragliding/frontend/Dockerfile
Scott Hatlen 88787b2eb1 Fix frontend unable to load weather data by using relative API URL
NEXT_PUBLIC_API_URL was only set at runtime via k8s ConfigMap, but Next.js
inlines NEXT_PUBLIC_* vars at build time. The fallback localhost:8080 URL was
baked into the JS bundle, causing all browser requests to fail. Changed default
to relative /api/v1 which routes correctly through the Ingress. Also updates
Dockerfile ENV syntax and k8s frontend port to 8080.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:59:31 -08:00

65 lines
1.1 KiB
Docker

# Dependencies stage
FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Set production environment
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
RUN npm run build
# Production stage
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# Set permissions for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Copy standalone output
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]
# Development stage
FROM node:20-alpine AS dev
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY . .
ENV NODE_ENV development
ENV NEXT_TELEMETRY_DISABLED 1
EXPOSE 3000
CMD ["npm", "run", "dev"]