docker compose : top level object must be mapping
Tags: docker, containerapps
Published: 2024-02-06 09:05:23

I use this command to build:
docker-compose -f docker-compose-new.yml -f Dockerfile-new config and getting top level object must be mapping though I can independentally run build the image using just docker.

my docker file:
`FROM node:18.16.1-slim as dependencies

WORKDIR /app

RUN npm install -g pnpm@8.6.2

RUN pnpm config set store-dir ~/.pnpm-store

COPY pnpm-lock.yaml .
RUN --mount=type=cache,target=~/.pnpm-store pnpm fetch
COPY package.json pnpm-workspace.yaml ./
# ============================================================================

FROM dependencies as orchestrator-client-builder

COPY client/package.json /app/client/

RUN pnpm install --offline --frozen-lockfile

COPY client/tsconfig.json client/.eslintrc.js /app/client/
COPY client/public /app/client/public
COPY client/src /app/client/src
COPY .env app/client/

RUN pnpm --filter=orchestrator-client build
# ============================================================================

FROM dependencies as orchestrator-server-builder

COPY server/package.json /app/server/
RUN pnpm install --offline --frozen-lockfile

RUN pnpm --filter=orchestrator-server --prod deploy pruned

COPY server/tsconfig.json server/.eslintrc.js /app/server/
COPY server/src /app/server/src

RUN pnpm --filter=orchestrator-server build
# ============================================================================

FROM nginx:1.24.0 as orchestrator-client

COPY client/nginx.conf /etc/nginx/conf.d/localhost.conf

COPY --from=orchestrator-client-builder \
    /app/client/build /usr/share/nginx/html
# ============================================================================

FROM node:18.16.1-slim as orchestrator-server

WORKDIR /app

COPY --from=orchestrator-server-builder /app/pruned/node_modules \
    /app/node_modules
COPY --from=orchestrator-server-builder /app/server/dist /app/dist

EXPOSE 8000

CMD ["node", "dist/src/index.js"]
# ============================================================================
`

docker compose file:
`
version: "3.9"
name: orchestrator

services:
  db:
    image: mongo:5.0.4
    container_name: orchestrator-db-container
    restart: always
    volumes:
      - /home/platform_shared_volumes/orchestrator/db:/data/db

  cache:
    image: redis:6.2.6
    container_name: orchestrator-cache-container
    restart: always
    volumes:
      - /home/platform_shared_volumes/orchestrator/cache:/data

  base:
    build:
      context: .
      target: dependencies
    image: base:${LOCK_HASH:-latest}
    profiles:
      - donotstart

  server:
    build:
      context: .
      target: orchestrator-server
    image: orchestrator-server:${SERVER_HASH:-latest}
    depends_on:
      - db
      - cache
    container_name: orchestrator-server-container
    restart: always
    environment:
      - JWT_SECRET=WT_VERB_CHECKPOINT_PROGRESS
      - PORT=8000
      - DB_URL=mongodb://db:27017/test
      - CLIENT_URL=https://dev.test.ai/dashboard
      - BACKEND_URL=https://dev.test.ai
      - REDIS_HOST=cache
      - REDIS_PORT=6379
      - EMAIL=myself@xyz.com
      - PASSWORD=test1234
      - MAX_TASK_VERSION=10
      - RENEW_API_URL=https://licensing.test.ai/api/licenses
      - CONFIG_KEY=WeWereOnBreak
      - AGENT_TYPES=single_task,single_task_attended,single_task_unattended,multiple_task,multiple_task_attended,multiple_task_unattended
      - SUPPORTED_AGENT_VERSIONS=2.3.7-9.0,2.4.0-10.0,2.4.0-11.0,2.4.0-11.1
      
  frontend:
    build:
      context: .
      target: orchestrator-client
    image: orchestrator-client:${SERVER_HASH:-latest}
    depends_on:
      - server
    container_name: orchestrator-client-container
    restart: always
    ports:
      - 3000:80
`

What I am missing here?!