feat: Implement local backend development setup with Docker Compose, introduce .dockerignore, and remove dev dependency pruning from the Dockerfile.
All checks were successful
Build and Deploy Backend / Build Backend Docker Image (push) Successful in 32s
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Successful in 34s
Build and Deploy Backend / Deploy E-learning Backend to Dev Server (push) Successful in 3s
Build and Deploy Frontend Learner / Deploy E-learning Frontend Learner to Dev Server (push) Successful in 2s
Build and Deploy Backend / Notify Deployment Status (push) Successful in 2s
Build and Deploy Frontend Learner / Notify Deployment Status (push) Successful in 2s

This commit is contained in:
JakkrapartXD 2026-02-10 14:26:09 +07:00
parent 0691ca40cd
commit d2e78dcfbb
3 changed files with 56 additions and 3 deletions

18
Backend/.dockerignore Normal file
View file

@ -0,0 +1,18 @@
node_modules
dist
.env
.env.local
.env.*.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
.DS_Store
*.swp
*.swo
*~
.vscode
.idea
coverage
.nyc_output
*.log

View file

@ -45,9 +45,6 @@ RUN pnpm install --frozen-lockfile --ignore-scripts=false
COPY --from=builder /app/prisma ./prisma COPY --from=builder /app/prisma ./prisma
RUN pnpm prisma:generate RUN pnpm prisma:generate
# Remove devDependencies (keep bcrypt and prisma client)
RUN pnpm prune --prod
# Copy built files from builder # Copy built files from builder
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public

View file

@ -63,6 +63,44 @@ services:
networks: networks:
- elearning-network - elearning-network
# Backend API (Local Build)
backend:
build:
context: .
dockerfile: Dockerfile
container_name: elearning-backend-local
restart: unless-stopped
ports:
- "4000:4000"
env_file:
- .env
environment:
- NODE_ENV=development
- DATABASE_URL=postgresql://postgres:12345678@postgres:5432/elearning_dev
- S3_ENDPOINT=http://minio:9000
- S3_ACCESS_KEY=admin
- S3_SECRET_KEY=12345678
- SMTP_HOST=mailhog
- SMTP_PORT=1025
volumes:
- ./src:/app/src
- ./prisma:/app/prisma
networks:
- elearning-network
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
mailhog:
condition: service_started
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4000/health" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Adminer - Database Management UI # Adminer - Database Management UI
adminer: adminer:
image: adminer:latest image: adminer:latest