Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docker compose build and push to docker hub | |
on: | |
workflow_call: | |
inputs: | |
application-name: | |
required: true | |
type: string | |
tag: | |
required: false | |
type: string | |
default: ${{ github.event.pull_request.head.sha || github.sha }} | |
push_to_docker_hub: | |
required: false | |
default: true | |
type: boolean | |
secrets: | |
dockerhub_user: | |
required: true | |
dockerhub_pass: | |
required: true | |
env: | |
TAG: ${{ inputs.tag }} | |
jobs: | |
compose_push: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@fix_load_yml | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@fix_load_yml | |
- name: Log in to Docker Hub | |
run: | | |
docker login -u ${{ secrets.dockerhub_user }} -p ${{ secrets.dockerhub_pass }} | |
- name: Compose up | |
uses: .github/actions/compose/action.yml | |
with: | |
application-name: ${{ inputs.application-name }} | |
- name: Push Docker image to Docker Hub | |
if: ${{ inputs.push_to_docker_hub }} | |
run: docker-compose -f docker-compose.test.yml push ${{ inputs.application-name}} | |
- name: Stop containers | |
if: always() | |
run: docker-compose -f docker-compose.test.yml down |