## # Docker Compose config file ## # Compose project name, to follow Docker tag for deployment environment (production, staging, feature, testing, local) # By default, if this is not specified, the directory name is used. The Compose project name is # prefixed to all resources such as networks/volumes/services, e.g. my-network/my-volume/my-service # will be created as production_my-network/production_my-volume/production-my-service-1 (note # underscores, hyphens & numeric suffix), but can be still referenced without the prefix/suffix in # this Docker Compose file and within the same Docker network. # This can be overridden in docker-compose.override.yml and is useful when deploying multiple # instances of the same application on the same machine, e.g. staging & feature, without having to # make a copy with new unique resource names such as "my-network-feature". See # https://docs.docker.com/compose/compose-file/04-version-and-name/ for more info. name: Asset-Recommender # Networks - do not use default network or set name else Compose project name will not be prefixed networks: demo-network: # Docker volumes - do not set name else Compose project name will not be prefixed # Volumes can be accessed on host machine via `Mountpoint` shown in `docker volume inspect ` on Linux # or `\\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\` in File Explorer on Windows (if using WSL) volumes: demo-app-log: # application log files stored here if any # Services - do not set container_name else Compose project name will not be prefixed. # All services should be prefixed with "demo-" to prevent conflict with Docker Compose files from other repos # See https://github.com/compose-spec/compose-spec/blob/master/spec.md#depends_on for depends_on conditions services: # db: # image: postgres:17-bookworm # container_name: postgres_db # env_file: # - .env # ports: # - "5434:5432" # expose internally to other containers # volumes: # # copy from folder initialize_db/ to docker-entrypoint-initdb.d # - ./initialize_db:/docker-entrypoint-initdb.d # # copy from folder ./data/raw to /data in docker container # - ./data/raw:/data app: build: context: . dockerfile: Dockerfile # On localhost, build the image first before running `docker compose` image: asset-recommendation:latest container_name: asset-recommendation-app ports: # use !override if modifying DEMO_PORT_* under `environment` attribute below without modifying .env # Publish ports - external:internal - "7860:7860" volumes: # It is mentioned in https://docs.docker.com/compose/compose-file/13-merge/#unique-resources that # "When merging Compose files, Compose appends new entries that do not violate a uniqueness constraint and # merge entries that share a unique key". The unique key for volumes is the target, not the source, hence # the following can be overridden by docker-compose.override.yml. - demo-app-log:/home/python/app/log - /tmp:/home/python/app/tmp env_file: # This imports all env vars from .env into the Docker container, avoiding the need to copy # .env in Dockerfile. No need to duplicate the list of env vars manually also, unless the # Docker container uses a different name, e.g. POSTGRES_USER=${DEMO_DB_USER} - .env command: poetry run gradio src/app.py # start application