Skip to content

Commit

Permalink
switch to reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Oct 22, 2024
1 parent 54bb501 commit 909dcce
Showing 1 changed file with 6 additions and 51 deletions.
57 changes: 6 additions & 51 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,9 @@ on:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_SECRET }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_REGISTRY }}/${{ vars.DOCKER_REGISTRY_PROJECT }}/${{ github.repository }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max


call-docker-build:
uses: ethdevops/workflows/.github/workflows/basic-docker-build.yaml@main
secrets:
docker_registry_user: ${{ secrets.DOCKER_REGISTRY_USER }}
docker_registry_password: ${{ secrets.DOCKER_REGISTRY_SECRET }}

0 comments on commit 909dcce

Please sign in to comment.