Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added docker-build-action #8

Merged
merged 2 commits into from
Dec 16, 2021

Conversation

christian-kreuzberger-dtx
Copy link
Member

@christian-kreuzberger-dtx christian-kreuzberger-dtx commented Dec 16, 2021

This PR

  • Adds reusable docker-build action

Example usage 1:

  docker_build:
    name: Docker Build
    runs-on: ubuntu-20.04
    env:
      VERSION: 1.0.1
    steps:
      - name: Checkout Code
        uses: actions/[email protected]

      - name: Docker Build Service
        id: docker_build_service
        uses: keptn/gh-automation/.github/actions/docker-build@feature/docker-build
        with:
          TAGS: |
            ${{ env.DOCKER_ORGANIZATION }}/${{ env.IMAGE }}:${{ env.VERSION }}
            ${{ env.DOCKER_ORGANIZATION }}/${{ env.IMAGE }}:${{ env.VERSION }}.${{ env.DATETIME }}
          BUILD_ARGS: |
            version=${{ env.VERSION }}
            datetime=${{ env.DATETIME }}
          REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
          REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}

      - name: Docker Build Initcontainer
        id: docker_build_initcontainer
        uses: keptn/gh-automation/.github/actions/docker-build@feature/docker-build
        with:
          TAGS: |
            ${{ env.DOCKER_ORGANIZATION }}/${{ env.IMAGE_INITCONTAINER }}:${{ env.VERSION }}
            ${{ env.DOCKER_ORGANIZATION }}/${{ env.IMAGE_INITCONTAINER }}:${{ env.VERSION }}.${{ env.DATETIME }}
          BUILD_ARGS: |
            version=${{ env.VERSION }}
            datetime=${{ env.DATETIME }}
          REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
          REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
          DOCKERFILE: ${{ env.DOCKERFILE_INITCONTAINER }}

Example usage 2:

      - name: Docker Build
        id: docker_build
        uses: keptn/gh-automation/.github/actions/docker-build@feature/docker-build
        with:
          TAGS: |
            ${{ env.DOCKER_ORGANIZATION }}/${{ env.IMAGE }}:${{ env.VERSION }}
            ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:${{ env.VERSION }}
          BUILD_ARGS: |
            version=${{ env.VERSION }}
            datetime=${{ env.DATETIME }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
          REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}

      - id: report_docker_build_to_pr
        name: Report Docker Build to PR
        if: (github.event_name == 'pull_request')
        uses: marocchino/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          recreate: true
          header: test
          message: |
            ```
            ${{ steps.docker_build.outputs.BUILD_METADATA }}
            ```

image

Signed-off-by: Christian Kreuzberger <[email protected]>
Signed-off-by: Christian Kreuzberger <[email protected]>
@christian-kreuzberger-dtx christian-kreuzberger-dtx marked this pull request as ready for review December 16, 2021 09:59
@christian-kreuzberger-dtx christian-kreuzberger-dtx deleted the feature/docker-build branch December 16, 2021 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants