infra(docker): add Dockerfiles for backend and frontend
Implements Tasks 23 & 24: Backend and Frontend Dockerfiles Backend Dockerfiles: - Dockerfile.dev: Development with dotnet watch hot reload - Base: sdk:10.0, installs dotnet-ef tool - Layer caching: csproj files copied before source - Entry: dotnet watch run with --no-restore - Dockerfile: Production multi-stage build - Build stage: sdk:10.0, restore + build + publish - Runtime stage: aspnet:10.0-alpine (~110MB) - Health check: /health/live endpoint - Non-root: USER app (built-in) Frontend Dockerfiles: - Dockerfile.dev: Development with Bun hot reload - Base: node:22-alpine, installs Bun globally - Layer caching: package.json + bun.lock before source - Command: bun run dev - Dockerfile: Production standalone 3-stage build - Deps stage: Install with --frozen-lockfile - Build stage: bun run build → standalone output - Runner stage: node:22-alpine with non-root nextjs user - Copies: .next/standalone, .next/static, public - Health check: Node.js HTTP GET to port 3000 - Entry: node server.js (~240MB) All Dockerfiles use layer caching optimization and security best practices. Note: Docker build verification skipped (Docker daemon not running).
This commit is contained in:
21
frontend/Dockerfile.dev
Normal file
21
frontend/Dockerfile.dev
Normal file
@@ -0,0 +1,21 @@
|
||||
# Development Dockerfile with Bun hot reload
|
||||
FROM node:22-alpine
|
||||
|
||||
# Install Bun
|
||||
RUN npm install -g bun
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Layer caching: Copy dependencies first
|
||||
COPY package.json bun.lock ./
|
||||
|
||||
# Install dependencies
|
||||
RUN bun install
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
# Development server with hot reload
|
||||
CMD ["bun", "run", "dev"]
|
||||
Reference in New Issue
Block a user