Skip to content

Commit

Permalink
feat: possibility to push docker image for other org
Browse files Browse the repository at this point in the history
  • Loading branch information
lenkan committed Feb 29, 2024
1 parent c8648e8 commit 0412fbf
Showing 1 changed file with 20 additions and 40 deletions.
60 changes: 20 additions & 40 deletions .github/workflows/publish-keria.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,37 @@

name: Publish Docker image

on:
push:
branches: ["main", "development"]
workflow_dispatch:
inputs:
version:
required: true

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out the repo
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: WebOfTrust/keria

- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker Layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: keri-${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
keri-${{ runner.os }}-buildx-
images: ${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: images/keria.dockerfile
push: true
tags: |
WebOfTrust/keria:${{ github.event.inputs.version }}
WebOfTrust/keria:latest
labels: ${{ github.event.inputs.version }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Move Docker cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 0412fbf

Please sign in to comment.