user3279954
user3279954

Reputation: 586

Azure Devops Docker Compose Build

Does Azure Docker-Compose V0 Task support building individual service instead of building all the services?

Below is the yaml dump of docker compose task. I want to build the individual service from the environment variable. But this always builds all the images.

steps:
- task: DockerCompose@0
  displayName: 'Run a Docker Compose command'
  inputs:
    containerregistrytype: 'Container Registry'
    dockerComposeFile: 'pathto/docker-compose.yml'
    dockerComposeCommand: build
    arguments: '$(ProjectName)'

Build output with debug flag=true

[debug]arguments:
[debug]   -f
[debug]   /pathToCompose/docker-compose.yml
[debug]   -f
[debug]   /myagent/.docker-compose.1583974576607.yml
[debug]   -p
[debug]   repository
[debug]   build
/usr/sbin/docker-compose -f /pathToCompose/docker-compose.yml -f /myagent/.docker-compose.1583974576607.yml -p repository build

Upvotes: 0

Views: 3407

Answers (1)

Mengdi Liang
Mengdi Liang

Reputation: 19026

Does Azure Docker-Compose V0 Task support building individual service instead of building all the services?

Yes, it does.

Just specify the service name you want to build in argument of task, which is what you were trying.

You need set system.debug to true in variables tab, then confirm your detailed log to confirm whether $(ProjectName) value was passed successfully. Because in debug log, we print the complete command:

enter image description here

newsfeed is one of my service name.


Update on 3/13/2020:

The Arguments blank of task definition is work for Build service images action, which means you can input your actual arguments there only after the Build service images action selected:

enter image description here

The Arguments blank does not work along with Run a Docker Compose command action.

When you choose that action, the method of argument applied should look like this:

enter image description here

Only this, the argument can be available for task.

enter image description here

Upvotes: 1

Related Questions