Skip to content

Commit

Permalink
ci: docker build on github actions
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Collins <[email protected]>
  • Loading branch information
alexec committed Mar 13, 2023
1 parent ad4e70c commit 17fb5a3
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.git
/.github
/.idea
/LICENSE
/release
29 changes: 29 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish Docker image

on:
push:
tags:
- v*

permissions:
packages: write

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u kitproj --password-stdin

- name: Build Docker image
run: docker build . --tag ghcr.io/kitproj/kafka:latest

- name: Tag Docker image
run: docker tag ghcr.io/kitproj/kafka:latest ghcr.io/kitproj/kafka:${GITHUB_REF#refs/*/}

- name: Push Docker images
run: docker push -a ghcr.io/kitproj/kafka
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
*.iml
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# kafka-kraft
# Kafka Docker

A self-contained Docker image for Kafka. Only one image needed, no Zookeeper (it uses KRaft). So much much easier for use in automated tests.
A self-contained Docker image for Kafka. Typically you must run multiple
images ([example](https://developer.confluent.io/quickstart/kafka-docker/)). This only requires a single image. This
reduces the complexity by an order of magnitude.

## Usage
On Docker:

```bash
docker run --rm -p 9092:9092 --name kafka alexcollinsintuit/kafka
docker run --rm -p 9092:9092 --name kafka kitproj/kafka
```

## Building
On Kubernetes:

```bash
# build the image
docker build --tag kafka .
```

```bash
# push to repository
docker tag kafka alexcollinsintuit/kafka
docker push alexcollinsintuit/kafka
```yaml
apiVersion: v1
kind: Pod
metadata:
name: kafka
spec:
containers:
- name: main
image: kitproj/kafka
ports:
- containerPort: 9092
```
7 changes: 7 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

command -v semver || go install github.com/ffurrer2/semver/v2/cmd/semver@latest

git tag v$(semver next patch $(git tag|sort -V|tail -n1|cut -c 2-))

git push --tags

0 comments on commit 17fb5a3

Please sign in to comment.