docker-compose.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. volumes:
  37. - miniodata:/data
  38. environment:
  39. MINIO_ROOT_USER: photoplaces
  40. MINIO_ROOT_PASSWORD: ${MINIO_PASSWORD:-photoplaces_dev}
  41. healthcheck:
  42. test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
  43. interval: 5s
  44. retries: 5
  45. migrate:
  46. image: migrate/migrate:v4.17
  47. command: -path=/migrations -database "postgres://photoplaces:${POSTGRES_PASSWORD:-photoplaces_dev}@postgres:5432/photoplaces?sslmode=disable" up
  48. volumes:
  49. - ./backend/migrations:/migrations
  50. depends_on:
  51. postgres:
  52. condition: service_healthy
  53. profiles:
  54. - tools
  55. backend:
  56. build:
  57. context: ./backend
  58. dockerfile: Dockerfile
  59. ports:
  60. - "8080:8080"
  61. environment:
  62. APP_ENV: ${APP_ENV:-development}
  63. DATABASE_URL: postgres://photoplaces:${POSTGRES_PASSWORD:-photoplaces_dev}@postgres:5432/photoplaces?sslmode=disable
  64. REDIS_URL: redis://:${REDIS_PASSWORD:-photoplaces_dev}@redis:6379/0
  65. S3_ENDPOINT: ${S3_ENDPOINT:-minio:9000}
  66. S3_ACCESS_KEY: photoplaces
  67. S3_SECRET_KEY: ${MINIO_PASSWORD:-photoplaces_dev}
  68. S3_BUCKET: photoplaces
  69. JWT_SECRET: ${JWT_SECRET:-dev-secret}
  70. JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:-dev-refresh-secret}
  71. CLOUDPAYMENTS_PUBLIC_ID: ""
  72. CLOUDPAYMENTS_API_SECRET: ""
  73. depends_on:
  74. postgres:
  75. condition: service_healthy
  76. redis:
  77. condition: service_healthy
  78. minio:
  79. condition: service_healthy
  80. volumes:
  81. - ./backend:/app
  82. healthcheck:
  83. test: ["CMD", "curl", "-sf", "http://localhost:8080/api/v1/health"]
  84. interval: 10s
  85. timeout: 5s
  86. retries: 5
  87. start_period: 10s
  88. frontend:
  89. build:
  90. context: ./frontend
  91. dockerfile: Dockerfile
  92. ports:
  93. - "3000:3000"
  94. environment:
  95. NEXT_PUBLIC_API_URL: http://localhost:8080/api/v1
  96. NEXT_PUBLIC_GIT_HASH: ${NEXT_PUBLIC_GIT_HASH:-dev}
  97. depends_on:
  98. backend:
  99. condition: service_healthy
  100. volumes:
  101. - ./frontend:/app
  102. - frontend-modules:/app/node_modules
  103. healthcheck:
  104. test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
  105. interval: 10s
  106. timeout: 5s
  107. retries: 5
  108. start_period: 15s
  109. volumes:
  110. pgdata:
  111. redisdata:
  112. miniodata:
  113. backend-modules:
  114. frontend-modules: