docker-compose.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. services:
  2. migrate:
  3. image: irdb-api:latest
  4. build: { context: ./api }
  5. command: migrate
  6. env_file: .env
  7. # SEC_REVIEW F20: rootfs read-only — /app source cannot be overwritten
  8. # by an RCE. Writable paths are restricted to the irdb-data volume
  9. # plus a few small tmpfs mounts (PHP `/tmp`, Caddy/FrankenPHP XDG
  10. # state). These tmpfs mounts inherit uid=1000 so the unprivileged
  11. # `app` user can write to them.
  12. read_only: true
  13. tmpfs:
  14. - /tmp:uid=1000,gid=1000,mode=1777
  15. - /home/app/.config:uid=1000,gid=1000,mode=0700
  16. - /home/app/.local/share:uid=1000,gid=1000,mode=0700
  17. volumes:
  18. - irdb-data:/data
  19. restart: "no"
  20. api:
  21. image: irdb-api:latest
  22. command: api
  23. env_file: .env
  24. # SEC_REVIEW F20: see migrate above.
  25. read_only: true
  26. tmpfs:
  27. - /tmp:uid=1000,gid=1000,mode=1777
  28. - /home/app/.config:uid=1000,gid=1000,mode=0700
  29. - /home/app/.local/share:uid=1000,gid=1000,mode=0700
  30. ports:
  31. - "${API_PORT:-8081}:8081"
  32. volumes:
  33. - irdb-data:/data
  34. depends_on:
  35. migrate:
  36. condition: service_completed_successfully
  37. healthcheck:
  38. test: ["CMD", "wget", "-qO-", "http://localhost:8081/healthz"]
  39. interval: 30s
  40. timeout: 5s
  41. retries: 3
  42. restart: unless-stopped
  43. ui:
  44. image: irdb-ui:latest
  45. build: { context: ./ui }
  46. env_file: .env
  47. # SEC_REVIEW F20: rootfs read-only. The ui has no /data volume —
  48. # all writes (PHP sessions in /tmp, Caddy/FrankenPHP XDG state) go
  49. # to ephemeral tmpfs mounts owned by uid=1000.
  50. read_only: true
  51. tmpfs:
  52. - /tmp:uid=1000,gid=1000,mode=1777
  53. - /home/app/.config:uid=1000,gid=1000,mode=0700
  54. - /home/app/.local/share:uid=1000,gid=1000,mode=0700
  55. ports:
  56. - "${UI_PORT:-8080}:8080"
  57. depends_on:
  58. api:
  59. condition: service_healthy
  60. healthcheck:
  61. test: ["CMD", "wget", "-qO-", "http://localhost:8080/healthz"]
  62. interval: 30s
  63. timeout: 5s
  64. retries: 3
  65. restart: unless-stopped
  66. # Uncomment to use MySQL. Also set DB_DRIVER=mysql in .env.
  67. # mysql:
  68. # image: mysql:8
  69. # environment:
  70. # MYSQL_DATABASE: ${DB_MYSQL_DATABASE}
  71. # MYSQL_USER: ${DB_MYSQL_USERNAME}
  72. # MYSQL_PASSWORD: ${DB_MYSQL_PASSWORD}
  73. # MYSQL_ROOT_PASSWORD: ${DB_MYSQL_ROOT_PASSWORD}
  74. # volumes:
  75. # - mysql-data:/var/lib/mysql
  76. # healthcheck:
  77. # test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
  78. # interval: 10s
  79. # timeout: 5s
  80. # retries: 10
  81. # restart: unless-stopped
  82. volumes:
  83. irdb-data:
  84. # mysql-data: