Using the .gitlab-ci.yml file to access the docker-compose.yml file

Hello,
I would be grateful if someone could clarify something for me. I have two servers:

GitLab Server: Repositories
GitLab Runner: Runner + Docker

On my GitLab server I have created a project with some code. In the root directory of my project, I have placed two files, .gitlab-ci.yml and Dockerfile.

The content of the .gitlab-ci.yml file is as follows:

stages:
  - build
  - deploy
before_script:
  - mkdir -p node_modules/
cache:
  paths:
    - node_modules/
build:
  stage: build
  only:
    - main
  script:
    - mkdir -p node_modules/
    - cd /data/containers/SOURCE/
    - git clone http://IP/project/test.git
deploy:
  stage: deploy
  only:
    - main
  script:
    - cd /data/containers/YAML

The docker-compose.yml file is located at /data/YAML directory on the GitLab runner server. If I add the following lines to the .gitlab-ci.yml file, then will this cause docker compose to use the docker-compose.yml file located in the /data/YAML directory?

deploy:
  stage: deploy
  only:
    - main
  script:
    - cd /data/YAML
    - docker compose build --no-cache
    - docker compose up -d

Any idea welcomed.

Cheers.

Hello

This post can help you Move the docker-compose.yml file to another directory

Hello,
Not really.
Are these commands executed on GitLab server or GitLab Runner server?

Thank you.