- Update Dockerfiles to use cannaiq.co as API base URL - Change findagram API client from /api/az to /api/v1 endpoints - Add trusted origin bypass in public-api middleware for consumer sites - Consumer sites (findagram.co, findadispo.com) can now access /api/v1 endpoints without API key authentication 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.3 KiB
Docker
54 lines
1.3 KiB
Docker
# Build stage
|
|
FROM node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies (using npm install since package-lock.json may not exist)
|
|
RUN npm install
|
|
|
|
# Copy source files
|
|
COPY . .
|
|
|
|
# Set build-time environment variable for API URL (CRA uses REACT_APP_ prefix)
|
|
# All consumer sites use cannaiq.co/api as the backend
|
|
ENV REACT_APP_API_URL=https://cannaiq.co
|
|
|
|
# Build the app (CRA produces /build, not /dist)
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Copy built assets from builder stage (CRA outputs to /build)
|
|
COPY --from=builder /app/build /usr/share/nginx/html
|
|
|
|
# Copy nginx config for SPA routing
|
|
RUN echo 'server { \
|
|
listen 80; \
|
|
server_name _; \
|
|
root /usr/share/nginx/html; \
|
|
index index.html; \
|
|
\
|
|
# Gzip compression \
|
|
gzip on; \
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; \
|
|
\
|
|
# Cache static assets \
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { \
|
|
expires 1y; \
|
|
add_header Cache-Control "public, immutable"; \
|
|
} \
|
|
\
|
|
# SPA fallback - serve index.html for all routes \
|
|
location / { \
|
|
try_files $uri $uri/ /index.html; \
|
|
} \
|
|
}' > /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|