docker-compose.dev.yaml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. services:
  2. db:
  3. image: mysql
  4. volumes:
  5. - ./.air/mysql:/var/lib/mysql
  6. api:
  7. image: cosmtrek/air
  8. working_dir: /work
  9. command: ["-c", "./scripts/.air.toml"]
  10. environment:
  11. - "MEMOS_DSN=root@tcp(db)/memos"
  12. - "MEMOS_DRIVER=mysql"
  13. volumes:
  14. - .:/work/
  15. - $HOME/go/pkg/:/go/pkg/ # Cache for go mod shared with the host
  16. web:
  17. image: node:18-alpine
  18. working_dir: /work
  19. depends_on: ["api"]
  20. ports: ["3001:3001"]
  21. environment: ["DEV_PROXY_SERVER=http://api:8081/"]
  22. entrypoint: ["/bin/sh", "-c"]
  23. command: ["corepack enable && pnpm install && pnpm dev"]
  24. volumes:
  25. - ./web:/work
  26. - ./.air/node_modules/:/work/node_modules/ # Cache for Node Modules
  27. # Services below are used for developers to run once
  28. #
  29. # You can just run `docker compose run --rm SERVICE_NAME` to use
  30. # For example:
  31. # To regenerate typescript code of gRPC proto
  32. # Just run `docker compose run --rm buf`
  33. #
  34. # All of theses services belongs to profile 'tools'
  35. # This will prevent to launch by normally `docker compose up` unexpectly
  36. # Generate typescript code of gRPC proto
  37. buf:
  38. profiles: ["tools"]
  39. image: bufbuild/buf
  40. working_dir: /work/proto
  41. command: generate
  42. volumes:
  43. - ./proto:/work/proto
  44. - ./web/src/types/:/work/web/src/types/
  45. # Do golang static code check before create PR
  46. golangci-lint:
  47. profiles: ["tools"]
  48. image: golangci/golangci-lint:v1.54.2
  49. working_dir: /work/
  50. command: golangci-lint run -v
  51. volumes:
  52. - $HOME/go/pkg/:/go/pkg/ # Cache for go mod shared with the host
  53. - .:/work/
  54. # Do javascript lint before create PR
  55. lint:
  56. profiles: ["tools"]
  57. image: node:18-alpine
  58. working_dir: /work
  59. command: npm run lint
  60. volumes:
  61. - ./web:/work
  62. - ./.air/node_modules/:/work/node_modules/