Skip to content

Commit

Permalink
build-images.yml: fix "." resolution for docker-compose files
Browse files Browse the repository at this point in the history
docker compose config -f with multiple docker compose files
uses the path of first compose file to resolve ".".
But we want to build all the docker images defined with docker compose in this repo,
thus we call docker compose config for all docker-compose files and merge the service
definitions.
  • Loading branch information
BacLuc committed Mar 6, 2024
1 parent cbf4e1c commit 9878c59
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,13 @@ jobs:
run: |
set -x
sudo snap install yq
compose_paths=""
for i in $(find . -name docker-compose.yml); do
compose_paths="$compose_paths -f $i"
done
export REPO_NAME=$(basename $(pwd))
docker compose $compose_paths config > /tmp/docker-compose.yml
echo "services:" > /tmp/docker-compose.yml
for i in $(find . -name docker-compose.yml); do
docker compose -f $i config | yq .services | sed 's/^/ /' >> /tmp/docker-compose.yml
done
yq_pipe='.services.[]'
yq_pipe=$yq_pipe'| select(.build != null)'
yq_pipe=$yq_pipe'| [.build * {"image": .image}]'
Expand Down

0 comments on commit 9878c59

Please sign in to comment.