Prefect base path url with docker-compose

Hi, I am trying to deploy prefect using docker-compose. Problem is that I would like to deploy with a base path configuration so the URL is http://machineIP:3000/test/api. Below is my docker-compose configuration, I am a novice when it comes to docker-compose configurations:

version: "3.9"
services:

  server:
    image: prefecthq/prefect:latest
    restart: always
    volumes:
      - prefect:/root/.prefect
    entrypoint: ["/opt/prefect/entrypoint.sh", "prefect", "server", "start"]
    environment:
      - PREFECT_UI_URL=http://127.0.0.0:3001/test/api
      - PREFECT_API_URL=http://127.0.0.1:3001/test/api
      - PREFECT_SERVER_API_HOST=0.0.0.0
      - PREFECT_API_DATABASE_CONNECTION_URL= my-connection-string-to-persistent-db
    ports:
      - 3001:3001

  agent:
    image: prefecthq/prefect:2.10.17-python3.11
    restart: always
    entrypoint: ["/opt/prefect/entrypoint.sh", "prefect", "agent", "start", "-q", "YOUR_WORK_QUEUE_NAME"]
    environment:
      - PREFECT_API_URL=http://server:3001/test/api

  ui:
    image: "prefecthq/ui:${PREFECT_UI_TAG:-latest}"
    ports:
      - 3000:3000
    command: "/intercept.sh"
    environment:
      PREFECT_SERVER__APOLLO_URL: "http://server:3001/test/api"
      PREFECT_SERVER__BASE_URL: "/test"
    restart: always
    depends_on:
      - server
      
networks:
  default:
    name: prefect-network

Questions:
Do I need to expose the 3001 post? All my flows are triggered through an API call to the server, can I just expose the 3000 port?

Any help on achieving this will be greatly appreciated!

Hello here u have changed the PREFECT_API_URL=http://server:3001/test/api how did u add test here in URL? I’m trying to change the PREFECT_API_URL similarly to my prefect URL.