Skip to content

Commit

Permalink
Fix: Make docker-compose cwd aware
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloconnor committed Dec 6, 2023
1 parent 178aeba commit 11a3473
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,34 @@ jobs:
- run: npm install
- uses: ./
with:
compose-file: "./docker/docker-compose.yml"
compose-file: "${{ github.workspace }}/docker/docker-compose.yml"
cwd: "${{ github.workspace }}"
services: |
helloworld2
helloworld3
- uses: ./
with:
compose-file: "./docker/docker-compose.yml"
cwd: "${{ github.workspace }}"
down-flags: "--volumes"
- uses: ./
with:
compose-file: "./docker/docker-compose.yml"
compose-flags: "--profile profile-1"
cwd: "${{ github.workspace }}"
down-flags: "--volumes"
- uses: ./
with:
compose-file: "./docker/docker-compose-with-env.yml"
cwd: "${{ github.workspace }}"
env:
IMAGE_NAME: hello-world
- uses: ./
with:
compose-file: |
./docker/docker-compose.yml
./docker/docker-compose.ci.yml
cwd: "${{ github.workspace }}"
services: |
helloworld2
helloworld4
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
description: "additional options to pass to `docker-compose` command"
required: false
default: ""
cwd: # id of input
description: "Current working directory"
required: false
default: ""
down-flags: # id of input
description: "additional options to pass to `docker-compose down` command"
required: false
Expand Down
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ try {

const options = {
config: composeFiles,
cwd: core.getInput("cwd"),
log: true,
composeOptions: utils.parseFlags(core.getInput("compose-flags")),
commandOptions: utils.parseFlags(core.getInput("up-flags")),
Expand Down
1 change: 1 addition & 0 deletions post.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ try {

const options = {
config: composeFiles,
cwd: core.getInput("cwd"),
log: true,
composeOptions: utils.parseFlags(core.getInput("compose-flags")),
commandOptions: utils.parseFlags(core.getInput("down-flags")),
Expand Down
2 changes: 1 addition & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports.parseComposeFiles = (composeFiles) => {
}

if (!fs.existsSync(composeFile)) {
console.log(`${composeFile} not exists`);
console.log(`${composeFile} does not exist`);
return false;
}

Expand Down

0 comments on commit 11a3473

Please sign in to comment.