Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 31 additions & 22 deletions .github/workflows/docker_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ on:
types: [published]
workflow_dispatch:

env:
DOCKERHUB_IMAGE_NAME: shawndengdocker/ibkr_event_daemon
GITHUB_IMAGE_NAME: ghcr.io/shawnden-coder/ibkr_event_daemon

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
name: Push Docker image to Docker Hub and GHCR
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand All @@ -28,33 +27,43 @@ jobs:
DOCKER_USERNAME: shawndengdocker
DOCKER_TOKEN: op://shawndengdev/dockerhub/credential

- name: Print Docker Username
run: echo "Docker Username: ${{ env.DOCKER_USERNAME }}"

- name: Print Image Name
run: echo "Image Name: ${{ env.DOCKER_USERNAME }}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')"

- name: Log in to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ env.PERSONAL_ACCESS_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_USERNAME }}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
images: |
${{ env.DOCKERHUB_IMAGE_NAME }}
${{ env.GITHUB_IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
type=ref,event=pr
type=sha,format=short

- name: Build and push Docker image
id: push
- name: Build and push Docker images
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ steps.meta.outputs.tags }}
${{ env.DOCKER_USERNAME }}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):latest
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}