summaryrefslogtreecommitdiffhomepage
path: root/docker-compose.yml
blob: 3d98bf109f596d3350abbd686c98c1aa3d5d02c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# --------------------------------------------------------------------------
# docker-compose.yml — One-command dev environment for the app.
#
# Key points:
#   • `volumes` bind-mounts the project root into /app so file changes on
#     the host are instantly visible inside the container (live reload).
#   • An anonymous volume for node_modules prevents the host's
#     node_modules from overriding the container's (they may differ by OS).
#   • `ports` maps container 5173 → host 5173 so you can open the app
#     at http://<host-ip>:5173 from any machine on your LAN.
# --------------------------------------------------------------------------

services:
  dev:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "5173:5173"
    volumes:
      # Mount the entire project directory into the container
      - .:/app

      # Keep container's node_modules separate from the host's.
      # This anonymous volume is created once, then reused across restarts.
      - /app/node_modules
    environment:
      # Tells Vite / chokidar to use polling for file-change detection,
      # which is required when code lives on a bind-mounted volume.
      - CHOKIDAR_USEPOLLING=true
    # Keep stdin open so we can interact if needed (e.g. Ctrl-C)
    stdin_open: true
    tty: true