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: publish build artifact as docker image #10

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
37 changes: 37 additions & 0 deletions .github/workflows/on-tagged-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Docker image for tag

on: workflow_dispatch

jobs:
push_to_registry:
name: Publish Docker image to nexus terrestris
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/') # Only run if the release is tagged
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
architecture: x64

- name: Build with Maven
run: mvn clean package

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

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ github.ref }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM docker.terrestris.de/busybox

ADD target/event-listener-shogun-jar-with-dependencies.jar /
Loading