chore(docker): add Dockerfiles and docker-compose for frontend and backend

- Add frontend Dockerfile with multi-stage build using node and nginx
- Add backend Dockerfile with multi-stage build to compile and serve app
- Add docker-compose.yml to define frontend and backend services with environment variables
- Configure nginx to serve SPA, enable gzip compression and caching for static assets
- Set up nginx reverse proxy for API requests to backend service on /api path
This commit is contained in:
MUIS1436
2026-01-31 10:03:30 +05:00
parent 5fa3fb3d15
commit d5cb1ded3e
4 changed files with 120 additions and 0 deletions

32
server/Dockerfile Normal file
View File

@@ -0,0 +1,32 @@
# Backend Dockerfile
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build TypeScript
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy package files and install production deps only
COPY package*.json ./
RUN npm ci --only=production
# Copy built code
COPY --from=builder /app/dist ./dist
EXPOSE 3001
CMD ["node", "dist/index.js"]