Files
cannaiq/findagram/frontend/Dockerfile
Kelly 7fe7d17b43 fix(consumer): Use relative API URLs for findadispo/findagram
The consumer frontends were hardcoded to use cannaiq.co as the API
URL, but each domain has its own /api path in the ingress that routes
to the shared backend. Using relative URLs allows each site to make
API calls to its own domain.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 13:38:10 -07:00

54 lines
1.4 KiB
Docker

# Build stage
FROM code.cannabrands.app/creationshop/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 . .
# Note: REACT_APP_API_URL is intentionally NOT set here
# The frontend uses relative URLs (same domain) in production
# API calls go to /api/* which the ingress routes to the backend
# Build the app (CRA produces /build, not /dist)
RUN npm run build
# Production stage
FROM code.cannabrands.app/creationshop/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;"]