Skip to content

Commit 4530f34

Browse files
committed
added spring-boot kafka
1 parent 0b0b026 commit 4530f34

File tree

16 files changed

+732
-38
lines changed

16 files changed

+732
-38
lines changed

.github/workflows/main.yml

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
1-
# This workflow for spring boot redis cache project
2-
name: Build and Push to Container Registry
3-
on:
4-
push:
5-
branches:
6-
- main
7-
env:
8-
REGISTRY: ghcr.io
9-
REPO_OWNER: ${{ github.repository_owner }}
1+
# name: Build and Push to Container Registry
2+
# on:
3+
# push:
4+
# branches:
5+
# - main
6+
# env:
7+
# REGISTRY: ghcr.io
8+
# REPO_OWNER: ${{ github.repository_owner }}
109

11-
jobs:
12-
build-and-push:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
10+
# jobs:
11+
# build-and-push:
12+
# runs-on: ubuntu-latest
13+
# steps:
14+
# - name: Checkout
15+
# uses: actions/checkout@v4
1716

18-
- name: Build with Maven
19-
run: mvn clean install
17+
# - name: Build with Maven
18+
# run: mvn clean install
2019

21-
- name: Log in Github Container Registry
22-
uses: docker/login-action@v2
23-
with:
24-
registry: ${{ env.REGISTRY }}
25-
username: ${{ github.actor }}
26-
password: ${{ secrets.GH_TOKEN }}
20+
# - name: Log in Github Container Registry
21+
# uses: docker/login-action@v2
22+
# with:
23+
# registry: ${{ env.REGISTRY }}
24+
# username: ${{ github.actor }}
25+
# password: ${{ secrets.GH_TOKEN }}
2726

28-
- name: Extract image metadata
29-
id: meta
30-
uses: docker/metadata-action@v4
31-
with:
32-
images: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/spring-boot-redis-cache
27+
# - name: Extract image metadata
28+
# id: meta
29+
# uses: docker/metadata-action@v4
30+
# with:
31+
# images: ${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/spring-boot-redis-cache
3332

34-
- name: Build and push
35-
uses: docker/build-push-action@v4
36-
with:
37-
context: .
38-
file: Dockerfile
39-
push: true
40-
tags: ${{ steps.meta.outputs.tags }}
41-
labels: ${{ steps.meta.outputs.labels }}
42-
build-args: |
43-
GITHUB_TOKEN=${{ secrets.GH_TOKEN }}
33+
# - name: Build and push
34+
# uses: docker/build-push-action@v4
35+
# with:
36+
# context: .
37+
# file: Dockerfile
38+
# push: true
39+
# tags: ${{ steps.meta.outputs.tags }}
40+
# labels: ${{ steps.meta.outputs.labels }}
41+
# build-args: |
42+
# GITHUB_TOKEN=${{ secrets.GH_TOKEN }}

spring-kafka/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/mvnw text eol=lf
2+
*.cmd text eol=crlf

spring-kafka/.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

spring-kafka/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM amazoncorretto:21 as build
2+
WORKDIR /app
3+
4+
COPY target/*.jar app.jar
5+
COPY application.yml ./application.yml
6+
7+
EXPOSE 8080
8+
9+
CMD ["java", "-jar", "app.jar"]

spring-kafka/docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3.8'
2+
3+
services:
4+
zookeeper:
5+
image: confluentinc/cp-zookeeper:latest
6+
container_name: zookeeper
7+
environment:
8+
ZOOKEEPER_CLIENT_PORT: 2181
9+
10+
kafka:
11+
image: confluentinc/cp-kafka:latest
12+
container_name: kafka
13+
depends_on:
14+
- zookeeper
15+
ports:
16+
- "9092:9092"
17+
environment:
18+
KAFKA_BROKER_ID: 1
19+
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
20+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
21+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
22+
23+
kafka-ui:
24+
image: provectuslabs/kafka-ui:latest
25+
container_name: kafka-ui
26+
ports:
27+
- "8081:8080"
28+
depends_on:
29+
- kafka
30+
environment:
31+
KAFKA_CLUSTERS_0_NAME: "local-cluster"
32+
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: "kafka:9092"
33+

0 commit comments

Comments
 (0)