Yes, you could integrate the two of them.Docker-Swarm can build an image from a Dockerfile just like a single-host Docker instance can, but the resulting image only lives on a single node and won’t be distributed to other nodes.
If you want to use Docker Compose to scale the service in question to multiple nodes, build the image, push it to a registry such as Docker Hub, and reference it from docker-compose.yml:
$ docker build -t myusername/web .
$ docker push myusername/web
$ cat docker-compose.yml
web:
image: myusername/web
$ docker-compose up -d
$ docker-compose scale web=3