puffin-app/Dockerfile
Matt bfb163c21a
Some checks failed
Build and Push Docker Images / docker (push) Failing after 1m54s
Remove Formspree and secure Wren API token
Security & Cleanup Changes:
1. Removed NEXT_PUBLIC_WREN_API_TOKEN from frontend (security risk)
2. Removed Formspree references (no longer needed)
3. Wren API token now lives in backend only (runtime configurable)
4. Added NocoDB env vars to frontend for admin portal server-side API

Changes:
- Dockerfile: Removed Formspree and NEXT_PUBLIC_WREN_API_TOKEN build args
- CI/CD: Updated build-args to only include necessary variables
- Frontend should call backend /api/wren/* endpoints
- Backend handles Wren API with WREN_API_TOKEN (can change anytime!)

Benefits:
 API token no longer exposed in browser
 Can change Wren token without rebuilding images
 Cleaner build process
 Removed unused Formspree dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 10:50:33 +01:00

47 lines
1.2 KiB
Docker

# Build Stage
FROM node:20-alpine AS build
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm ci
# Copy the rest of the app
COPY . .
# Accept build arguments for NEXT_PUBLIC_ variables
# These MUST be provided at build time
ARG NEXT_PUBLIC_API_BASE_URL
ARG NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
# Set as environment variables so Next.js can bake them into the build
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
ENV NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=$NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
# Build Next.js app (standalone mode)
# NEXT_PUBLIC_ variables are now baked in at build time
RUN npm run build
# Production Stage - Next.js standalone server
FROM node:20-alpine
WORKDIR /app
# Copy standalone server files from build stage
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/public ./public
# Expose port 3000
EXPOSE 3000
# Set environment to production
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# Start Next.js server
# Runtime environment variables (NEXT_PUBLIC_*) can be passed via docker-compose or -e flags
CMD ["node", "server.js"]