feat #58 - publish docker image with demo app
Build and Publish Docker Image / build-and-push (push) Waiting to run
Unit test coverage / pytest (push) Failing after 1m20s
/ build-and-push (push) Successful in 1m30s

This commit is contained in:
Stanislav Hejny
2025-07-01 21:45:11 +01:00
parent 00018c79ac
commit 98129b86d0
3 changed files with 40 additions and 15 deletions
+38 -13
View File
@@ -1,35 +1,58 @@
name: Build and Publish Docker Image name: Build and Publish Docker Image
#on:
# push:
# branches: [ main, master ]
# tags: [ 'v*' ]
# pull_request:
# branches: [ main, master ]
on: on:
push: push:
branches: [ main, master ] branches:
tags: [ 'v*' ] - master # publish release on master
pull_request: - develop # publish snapshot on develop
branches: [ main, master ] - feat-58-backpressure-reactive-streams
workflow_dispatch:
# allow manual trigger
env:
REGISTRY_URL: "git.cleverthis.com"
REPOSITORY: "clevermicro/amq-adapter-python-demo"
DOCKER_HOST: "tcp://dind:2375"
jobs: jobs:
build-and-push: build-and-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services:
dind:
image: docker:dind
cmd:
- dockerd
- -H
- tcp://0.0.0.0:2375
- --tls=false
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Login to Docker Registry - name: Login to Docker Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: ${{ secrets.DOCKER_REGISTRY }} registry: ${{ env.REGISTRY_URL }}
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
- name: Extract metadata for Docker - name: Extract metadata for Docker
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: ${{ secrets.DOCKER_REGISTRY }}/clevermicro/amq-adapter-python-demo images: ${{ env.REGISTRY_URL }}/clevermicro/amq-adapter-python-demo
tags: | tags: |
type=ref,event=branch type=ref,event=branch
type=ref,event=pr type=ref,event=pr
@@ -38,11 +61,13 @@ jobs:
type=sha,format=short type=sha,format=short
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v6
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }} # push: ${{ github.event_name != 'pull_request' }}
push: true
tags: ${{ env.REGISTRY_URL }}/${{ env.REPOSITORY }}:latest
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
+1 -1
View File
@@ -2,7 +2,7 @@ on: [push]
env: env:
REGISTRY_URL: "git.cleverthis.com" REGISTRY_URL: "git.cleverthis.com"
REPOSITORY: "clevermicro/amq-adapter-python" REPOSITORY: "clevermicro/amq-adapter-python-demo"
DOCKER_HOST: "tcp://dind:2375" DOCKER_HOST: "tcp://dind:2375"
jobs: jobs:
+1 -1
View File
@@ -56,7 +56,7 @@ amq_adapter.egg-info/
build/ build/
unused-code/ unused-code/
.vscode/
amq_adapter.egg-info/ amq_adapter.egg-info/
build/ build/
coverage.xml coverage.xml