docker-compose.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. x-env: &env
  2. POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-photoplaces_dev}
  3. REDIS_PASSWORD: ${REDIS_PASSWORD:-photoplaces_dev}
  4. MINIO_PASSWORD: ${MINIO_PASSWORD:-photoplaces_dev}
  5. services:
  6. postgres:
  7. image: postgis/postgis:16-3.4-alpine
  8. environment:
  9. POSTGRES_DB: photoplaces
  10. POSTGRES_USER: photoplaces
  11. POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-photoplaces_dev}
  12. ports:
  13. - "5432:5432"
  14. volumes:
  15. - pgdata:/var/lib/postgresql/data
  16. healthcheck:
  17. test: ["CMD-SHELL", "pg_isready -U photoplaces"]
  18. interval: 5s
  19. retries: 5
  20. redis:
  21. image: redis:7-alpine
  22. command: redis-server --requirepass ${REDIS_PASSWORD:-photoplaces_dev}
  23. ports:
  24. - "6379:6379"
  25. volumes:
  26. - redisdata:/data
  27. healthcheck:
  28. test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-photoplaces_dev}", "ping"]
  29. interval: 5s
  30. retries: 5
  31. minio:
  32. image: minio/minio:latest
  33. command: server /data --console-address ":9001"
  34. ports:
  35. - "9000:9000"
  36. - "9001:9001"
  37. volumes:
  38. - miniodata:/data
  39. environment:
  40. MINIO_ROOT_USER: photoplaces
  41. MINIO_ROOT_PASSWORD: ${MINIO_PASSWORD:-photoplaces_dev}
  42. healthcheck:
  43. test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
  44. interval: 5s
  45. retries: 5
  46. migrate:
  47. image: migrate/migrate:v4.17
  48. command: -path=/migrations -database "postgres://photoplaces:${POSTGRES_PASSWORD:-photoplaces_dev}@postgres:5432/photoplaces?sslmode=disable" up
  49. volumes:
  50. - ./backend/migrations:/migrations
  51. depends_on:
  52. postgres:
  53. condition: service_healthy
  54. profiles:
  55. - tools
  56. backend:
  57. build:
  58. context: ./backend
  59. dockerfile: Dockerfile
  60. ports:
  61. - "8080:8080"
  62. environment:
  63. APP_ENV: ${APP_ENV:-development}
  64. DATABASE_URL: postgres://photoplaces:${POSTGRES_PASSWORD:-photoplaces_dev}@postgres:5432/photoplaces?sslmode=disable
  65. REDIS_URL: redis://:${REDIS_PASSWORD:-photoplaces_dev}@redis:6379/0
  66. S3_ENDPOINT: http://minio:9000
  67. S3_ACCESS_KEY: photoplaces
  68. S3_SECRET_KEY: ${MINIO_PASSWORD:-photoplaces_dev}
  69. S3_BUCKET: photoplaces
  70. JWT_SECRET: ${JWT_SECRET:-dev-secret}
  71. JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:-dev-refresh-secret}
  72. CLOUDPAYMENTS_PUBLIC_ID: ""
  73. CLOUDPAYMENTS_API_SECRET: ""
  74. depends_on:
  75. postgres:
  76. condition: service_healthy
  77. redis:
  78. condition: service_healthy
  79. minio:
  80. condition: service_healthy
  81. volumes:
  82. - ./backend:/app
  83. - backend-modules:/app/node_modules
  84. healthcheck:
  85. test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/api/v1/health"]
  86. interval: 10s
  87. timeout: 5s
  88. retries: 5
  89. start_period: 10s
  90. frontend:
  91. build:
  92. context: ./frontend
  93. dockerfile: Dockerfile
  94. ports:
  95. - "3000:3000"
  96. environment:
  97. NEXT_PUBLIC_API_URL: http://localhost:8080/api/v1
  98. NEXT_PUBLIC_MAP_PROVIDER: yandex
  99. NEXT_PUBLIC_YANDEX_MAPS_API_KEY: ""
  100. depends_on:
  101. backend:
  102. condition: service_healthy
  103. volumes:
  104. - ./frontend:/app
  105. - frontend-modules:/app/node_modules
  106. healthcheck:
  107. test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
  108. interval: 10s
  109. timeout: 5s
  110. retries: 5
  111. start_period: 15s
  112. volumes:
  113. pgdata:
  114. redisdata:
  115. miniodata:
  116. backend-modules:
  117. frontend-modules: