version: "3.9" x-common: &common restart: unless-stopped networks: - photoplaces services: postgres: <<: *common image: postgis/postgis:16-3.4-alpine environment: POSTGRES_DB: photoplaces POSTGRES_USER: photoplaces POSTGRES_PASSWORD: ${DB_PASSWORD} volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U photoplaces"] interval: 10s retries: 5 redis: <<: *common image: redis:7-alpine command: redis-server --requirepass ${REDIS_PASSWORD} volumes: - redisdata:/data healthcheck: test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"] interval: 10s retries: 5 minio: <<: *common image: minio/minio:latest command: server /data volumes: - miniodata:/data environment: MINIO_ROOT_USER: ${S3_ACCESS_KEY} MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 10s retries: 5 migrations: <<: *common image: migrate/migrate:v4.17 command: -path=/migrations -database "postgres://photoplaces:${DB_PASSWORD}@postgres:5432/photoplaces?sslmode=disable" up volumes: - ./backend/migrations:/migrations depends_on: postgres: condition: service_healthy backend: <<: *common build: context: ./backend dockerfile: Dockerfile ports: - "127.0.0.1:8080:8080" environment: APP_ENV: production SERVER_PORT: "8080" DATABASE_URL: postgres://photoplaces:${DB_PASSWORD}@postgres:5432/photoplaces?sslmode=disable REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0 S3_ENDPOINT: http://minio:9000 S3_ACCESS_KEY: ${S3_ACCESS_KEY} S3_SECRET_KEY: ${S3_SECRET_KEY} S3_BUCKET: photoplaces JWT_SECRET: ${JWT_SECRET} JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET} CLOUDPAYMENTS_PUBLIC_ID: ${CLOUDPAYMENTS_PUBLIC_ID} CLOUDPAYMENTS_API_SECRET: ${CLOUDPAYMENTS_API_SECRET} ALLOWED_ORIGINS: ${ALLOWED_ORIGINS} depends_on: migrations: condition: service_completed_successfully frontend: <<: *common build: context: ./frontend dockerfile: Dockerfile args: NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL} NEXT_PUBLIC_MAP_PROVIDER: yandex NEXT_PUBLIC_YANDEX_MAPS_API_KEY: ${YANDEX_MAPS_API_KEY} ports: - "127.0.0.1:3000:3000" depends_on: - backend volumes: pgdata: redisdata: miniodata: networks: photoplaces: