docker-compose.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. services:
  2. # Service pour le backend
  3. framed-server:
  4. build:
  5. context: .
  6. dockerfile: Dockerfile
  7. container_name: framed-tracker-server
  8. restart: unless-stopped
  9. ports:
  10. - "3000:3000"
  11. volumes:
  12. - ./server:/app
  13. - ./data:/app/data
  14. - ./backups:/app/backups
  15. environment:
  16. - NODE_ENV=production
  17. - PORT=3000
  18. - DB_PATH=/app/data/framed.db
  19. # Service pour le frontend (en développement)
  20. framed-client-dev:
  21. image: node:18-alpine
  22. container_name: framed-tracker-client-dev
  23. restart: unless-stopped
  24. working_dir: /app
  25. ports:
  26. - "3001:3001"
  27. volumes:
  28. - ./client:/app
  29. environment:
  30. - PORT=3001
  31. - REACT_APP_API_URL=http://localhost:3000/api
  32. command: sh -c "npm install && npm start"
  33. depends_on:
  34. - framed-server
  35. # Service pour construire le frontend (production)
  36. framed-client-build:
  37. image: node:18-alpine
  38. container_name: framed-tracker-client-build
  39. working_dir: /app
  40. volumes:
  41. - ./client:/app
  42. - ./server/public:/output
  43. environment:
  44. - REACT_APP_API_URL=/api
  45. command: sh -c "npm install && npm run build && cp -r build/* /output/"
  46. profiles:
  47. - build
  48. # Service nginx pour servir l'application en production
  49. framed-nginx:
  50. image: nginx:alpine
  51. container_name: framed-tracker-nginx
  52. restart: unless-stopped
  53. ports:
  54. - "80:80"
  55. volumes:
  56. - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
  57. - ./server/public:/usr/share/nginx/html
  58. depends_on:
  59. - framed-server
  60. profiles:
  61. - prod