Can i use a single docker-compose.yml to build and use an image?

Hello, i have a service which creates 5 docker containers, two based on Dockerhub images and three from an own image in my Gitlab-Server repository. Currently i have two compose-files, one for creating the image only and another one to create and deploy the containers from them.
Is there a way to integrate them in a common compose-file?

Yes of course, would you mind pasting the compose files here?