Files
bestofpb/Dockerfile
Scott Hatlen e9a867f8fc
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m24s
Add CI/CD workflow and use Harbor cache for base images
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 20:30:18 -07:00

51 lines
1.1 KiB
Docker

# Multi-stage build for React Awards Map
FROM harbor.scottyah.com/dockerhub-cache/library/node:20-alpine AS frontend-builder
WORKDIR /app/frontend
# Copy frontend package files
COPY frontend/package*.json ./
# Install frontend dependencies
RUN npm ci
# Copy frontend source
COPY frontend/ ./
# Build frontend for production
RUN npm run build
# Production stage
FROM harbor.scottyah.com/dockerhub-cache/library/node:20-alpine
WORKDIR /app
# Copy backend package files
COPY backend/package*.json ./
# Install production dependencies only
RUN npm ci --only=production
# Copy backend source
COPY backend/ ./
# Copy built frontend from builder stage
COPY --from=frontend-builder /app/frontend/dist ./dist
# Create directory for database
RUN mkdir -p /app/data
# Expose port
EXPOSE 4000
# Set production environment
ENV NODE_ENV=production
ENV DATABASE_PATH=/app/data/awards.db
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:4000/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
# Start the application
CMD ["node", "index.js"]