Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
2.0 KB
Raw Blame
x-db-env: &db_env
  POSTGRES_USER: postgres
  POSTGRES_DB: postgres
  POSTGRES_PASSWORD: postgres

x-rails-env: &rails_env
  DB_HOST: db
  # Bind the dev server to all interfaces inside the container so Docker's
  # published port reaches it from the host. Rails reads BINDING natively.
  BINDING: "0.0.0.0"
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: postgres
  BUNDLE_PATH: /bundle
  REDIS_URL: redis://redis:6379/1
  SELENIUM_REMOTE_URL: http://selenium:4444

services:
  app:
    build:
      context: ..
      dockerfile: .devcontainer/Dockerfile
    volumes:
      - ./.bashrc:/root/.bashrc:ro,cached
      - ..:/workspace:cached
      - bundle_cache:/bundle
    ports:
      - ${PORT:-3000}:3000
    command: sleep infinity
    environment:
      <<: *rails_env
    depends_on:
      - db
      - redis
      - selenium

  worker:
    build:
      context: ..
      dockerfile: .devcontainer/Dockerfile
    volumes:
      - ..:/workspace:cached
      - bundle_cache:/bundle
    command: bundle exec sidekiq
    restart: unless-stopped
    environment:
      <<: *rails_env
    depends_on:
      - redis

  redis:
    image: redis:latest
    volumes:
      - redis-data:/data
    restart: unless-stopped
  
  db:
    # pgvector build, as docs/hosting/ai.md prescribes for the pgvector
    # provider ("instead of `postgres:16` (drop-in replacement)"). Plain
    # postgres:16 has no `vector` extension, so VectorStore::Pgvector
    # .available? returns false and Imports -> New renders no upload option at
    # all -- document and PDF import cannot be exercised in the devcontainer.
    image: pgvector/pgvector:pg16-trixie
    volumes:
      - postgres-data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: unless-stopped
    environment:
      <<: *db_env

  selenium:
    image: selenium/standalone-chromium:latest
    ports:
      - "4444:4444"
      - "7900:7900"
    shm_size: 2gb
    restart: unless-stopped
    environment:
      SE_NODE_MAX_SESSIONS: 4
      SE_NODE_OVERRIDE_MAX_SESSIONS: "true"

volumes:
  postgres-data:
  redis-data:
  bundle_cache: