ocd-website/backend/Dockerfile
TheMaddax edb6faa351 feat: create project structure and update implementation files
- Created complete project directory structure:
  - Frontend with Next.js 15.2.3 app router structure
  - Backend with Express API endpoints
  - Docker configurations with security best practices
  - MongoDB initialization with schema validation
  - Nginx configuration with security headers

- Implemented core file templates:
  - Custom video player with transcript display options
  - MongoDB schemas with validation for Videos and Members
  - JWT authentication middleware with role-based access control
  - Docker Compose with resource limits and security
  - Frontend/backend package.json with dependencies

- Updated documentation:
  - Enhanced TECH_STACK with latest version details
  - Updated TO_DO.txt with WCAG 2.2 AA requirements
  - Updated planned_implementation.txt with current best practices
  - Refreshed all Memory Bank files with current state

- Security and accessibility improvements:
  - Added MongoDB 7.0 schema validation with
  - Enhanced video requirements with mandatory transcripts and thumbnails
  - Updated accessibility to WCAG 2.2 AA standards
  - Added security best practices for Docker deployments
2025-03-25 09:28:10 -05:00

44 lines
1 KiB
Docker

# Build stage
FROM node:22-alpine AS build
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm ci
# Copy source code
COPY . .
# Build the app
RUN npm run build
# Production stage
FROM node:22-alpine
# Create app directory with non-root user
WORKDIR /app
RUN addgroup -S appgroup && adduser -S appuser -G appgroup && \
chown -R appuser:appgroup /app
# Copy built assets from build stage
COPY --from=build --chown=appuser:appgroup /app/dist ./dist
COPY --from=build --chown=appuser:appgroup /app/node_modules ./node_modules
COPY --from=build --chown=appuser:appgroup /app/package.json ./package.json
# Security best practices
ENV NODE_ENV=production
RUN npm prune --production
# Set permissions and switch to non-root user
USER appuser
# Expose port
EXPOSE 4000
# Health check endpoint
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:4000/health || exit 1
# Start the application
CMD ["npm", "start"]