docker-compose.dev.yaml 855 B

1234567891011121314151617181920212223242526272829
  1. # 1.Prepare your workspace by:
  2. # docker compose run api go install github.com/cosmtrek/air@latest
  3. # docker compose run web npm install
  4. #
  5. # 2. Start you work by:
  6. # docker compose up -d
  7. #
  8. # 3. Check logs by:
  9. # docker compose logs -f
  10. #
  11. services:
  12. api:
  13. image: golang:1.19.3-alpine3.16
  14. working_dir: /work
  15. command: air -c ./scripts/.air.toml
  16. volumes:
  17. - $HOME/go/pkg/:/go/pkg/ # Cache for go mod shared with the host
  18. - ./.air/bin/:/go/bin/ # Cache for binary used only in container, such as *air*
  19. - .:/work/
  20. web:
  21. image: node:18.12.1-alpine3.16
  22. working_dir: /work
  23. depends_on: ["api"]
  24. ports: ["3001:3001"]
  25. environment: ["DEV_PROXY_SERVER=http://api:8081/"]
  26. command: npm run dev
  27. volumes:
  28. - ./web:/work
  29. - ./.air/node_modules/:/work/node_modules/ # Cache for Node Modules