mirror of
https://github.com/hoverkraft-tech/compose-action.git
synced 2026-01-11 15:13:06 +08:00
Clarify option name, add test volume to docker-compose.yml file
This commit is contained in:
parent
9b11ac16a8
commit
95610cce4b
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -9,4 +9,4 @@ jobs:
|
|||||||
- uses: isbang/compose-action@v0.1
|
- uses: isbang/compose-action@v0.1
|
||||||
with:
|
with:
|
||||||
compose-file: './docker/docker-compose.yml'
|
compose-file: './docker/docker-compose.yml'
|
||||||
down-options: '--volumes'
|
down-flags: '--volumes'
|
||||||
|
|||||||
@ -8,9 +8,9 @@ This action runs your docker-compose file and clean up before action finished.
|
|||||||
|
|
||||||
**Optional** The name of the compose file. Default `"./docker-compose.yml"`.
|
**Optional** The name of the compose file. Default `"./docker-compose.yml"`.
|
||||||
|
|
||||||
### `down-options`
|
### `down-flags`
|
||||||
|
|
||||||
**Optional** Options to pass to the `docker-compose down` command during cleanup. Default is none. Primarily used to pass the `--volumes` flag if you want persistent volumes to be deleted as well during cleanup.
|
**Optional** Used to specify flags to pass to the `docker-compose down` command during cleanup. Default is none. Can be used to pass the `--volumes` flag, for example, if you want persistent volumes to be deleted as well during cleanup. A full list of flags can be found in the [docker-compose down documentation](https://docs.docker.com/compose/reference/down/).
|
||||||
|
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
|
|||||||
@ -5,7 +5,7 @@ inputs:
|
|||||||
description: 'relative path to compose file'
|
description: 'relative path to compose file'
|
||||||
required: false
|
required: false
|
||||||
default: './docker-compose.yml'
|
default: './docker-compose.yml'
|
||||||
down-options: # id of input
|
down-flags: # id of input
|
||||||
description: 'additional options to pass to `docker-compose down` command'
|
description: 'additional options to pass to `docker-compose down` command'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
|||||||
@ -1,4 +1,10 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
test_volume: {}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
helloworld:
|
helloworld:
|
||||||
image: hello-world
|
image: hello-world
|
||||||
|
volumes:
|
||||||
|
- test_volume:/test:Z
|
||||||
|
|||||||
6
post.js
6
post.js
@ -4,11 +4,11 @@ const fs = require('fs');
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const composeFile = core.getInput('compose-file');
|
const composeFile = core.getInput('compose-file');
|
||||||
const downOptionsString = core.getInput('down-options');
|
const downFlagsString = core.getInput('down-flags');
|
||||||
|
|
||||||
let options = { config: composeFile, log: true};
|
let options = { config: composeFile, log: true};
|
||||||
if (downOptionsString.length > 0)
|
if (downFlagsString.length > 0)
|
||||||
options['commandOptions'] = downOptionsString.split(" ");
|
options['commandOptions'] = downFlagsString.split(" ");
|
||||||
|
|
||||||
if (!fs.existsSync(composeFile)) {
|
if (!fs.existsSync(composeFile)) {
|
||||||
console.log(`${composeFile} not exists`);
|
console.log(`${composeFile} not exists`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user