docker-compose.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 ":9002"
  34. ports:
  35. - "9000:9000"
  36. - "9002:9002"
  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: ${S3_ENDPOINT:-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. healthcheck:
  84. test: ["CMD", "curl", "-sf", "http://localhost:8080/api/v1/health"]
  85. interval: 10s
  86. timeout: 5s
  87. retries: 5
  88. start_period: 10s
  89. frontend:
  90. build:
  91. context: ./frontend
  92. dockerfile: Dockerfile
  93. ports:
  94. - "3000:3000"
  95. environment:
  96. NEXT_PUBLIC_API_URL: http://localhost:8080/api/v1
  97. NEXT_PUBLIC_GIT_HASH: ${NEXT_PUBLIC_GIT_HASH:-dev}
  98. depends_on:
  99. backend:
  100. condition: service_healthy
  101. volumes:
  102. - ./frontend:/app
  103. - frontend-modules:/app/node_modules
  104. healthcheck:
  105. test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
  106. interval: 10s
  107. timeout: 5s
  108. retries: 5
  109. start_period: 15s
  110. volumes:
  111. pgdata:
  112. redisdata:
  113. miniodata:
  114. backend-modules:
  115. frontend-modules: