Skip to content

RosemanLabs/gha-compose-action

This branch is 49 commits behind hoverkraft-tech/compose-action:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e040f96 · Apr 19, 2024

History

77 Commits
Mar 29, 2024
Apr 16, 2024
Apr 16, 2024
Apr 2, 2024
Apr 3, 2024
Mar 26, 2024
Mar 29, 2024
Mar 29, 2024
Mar 29, 2024
Apr 2, 2024
Apr 16, 2024
Apr 16, 2024
Mar 29, 2024
Apr 2, 2024
Apr 2, 2024
Apr 19, 2024
Mar 29, 2024
Mar 29, 2024

Repository files navigation

branding<icon:anchor color:gray-dark>

branding<icon:anchor color:gray-dark> GitHub Action: Docker Compose Action

Release%20by%20tagRelease%20by%20dateCommitOpen%20IssuesDownloads

This action runs your docker-compose file and clean up before action finished

Usage

Action

The action will run docker-compose up to start the services defined in the given compose file(s). The compose file(s) can be specified using the compose-file input. Some extra options can be passed to the docker-compose up command using the up-flags input.

Post hook

On post hook, the action will run docker-compose down to clean up the services. In debug mode, the logs of the running services are printed before the cleanup.

Some extra options can be passed to the docker-compose down command using the down-flags input.

- uses: hoverkraft-tech/[email protected]
  with:
    # Description: Relative path to compose file(s). It can be a list of files.
    #
    # Default: ./docker-compose.yml
    compose-file: ""

    # Description: Services to perform docker-compose up.
    #
    services: ""

    # Description: Additional options to pass to `docker-compose up` command.
    #
    # Default:
    up-flags: ""

    # Description: Additional options to pass to `docker-compose down` command.
    #
    # Default:
    down-flags: ""

    # Description: Additional options to pass to `docker-compose` command.
    #
    # Default:
    compose-flags: ""

    # Description: Current working directory
    #
    # Default: ${{ github.workspace }}
    cwd: ""

Inputs

Input Description Default Required
compose-file Relative path to compose file(s). It can be a list of files. ./docker-compose.yml false
services Services to perform docker-compose up. false
up-flags Additional options to pass to docker-compose up command. false
down-flags Additional options to pass to docker-compose down command. false
compose-flags Additional options to pass to docker-compose command. false
cwd Current working directory ${{ github.workspace }} false

Examples

Example Using environment variables

steps:
  - uses: actions/checkout@v4
  - uses: hoverkraft-tech/[email protected]
    with:
      compose-file: "./docker/docker-compose.yml"
    env:
      CUSTOM_VARIABLE: "test"

Example using services

Perform docker-compose up to some given service instead of all of them

steps:
  # need checkout before using compose-action
  - uses: actions/checkout@v3
  - uses: hoverkraft-tech/[email protected]
    with:
      compose-file: "./docker/docker-compose.yml"
      services: |
        helloworld2
        helloworld3

Example using up-flags

Specify flags to pass to the docker-compose up. Default is none. Can be used to pass the --build 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 up documentation.

Example using down-flags

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.

Example using compose-flags

Specify flags to pass to the docker-compose command. Default is none. A full list of flags can be found in the docker-compose documentation.

steps:
  # need checkout before using compose-action
  - uses: actions/checkout@v3
  - uses: hoverkraft-tech/[email protected]
    with:
      compose-file: "./docker/docker-compose.yml"
      services: |
        helloworld2
        helloworld3

About

This action runs your docker-compose file and clean up before action finished

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 98.0%
  • Shell 1.4%
  • Dockerfile 0.6%