diff --git a/Backend/.dockerignore b/Backend/.dockerignore new file mode 100644 index 00000000..be39a97b --- /dev/null +++ b/Backend/.dockerignore @@ -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 diff --git a/Backend/Dockerfile b/Backend/Dockerfile index b959e271..6d3a53c5 100644 --- a/Backend/Dockerfile +++ b/Backend/Dockerfile @@ -45,9 +45,6 @@ RUN pnpm install --frozen-lockfile --ignore-scripts=false COPY --from=builder /app/prisma ./prisma RUN pnpm prisma:generate -# Remove devDependencies (keep bcrypt and prisma client) -RUN pnpm prune --prod - # Copy built files from builder COPY --from=builder /app/dist ./dist COPY --from=builder /app/public ./public diff --git a/Backend/compose.yaml b/Backend/compose.yaml index bac438f4..e020d229 100644 --- a/Backend/compose.yaml +++ b/Backend/compose.yaml @@ -63,6 +63,44 @@ services: networks: - 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: image: adminer:latest