Skip to content

Commit 75ac183

Browse files
committed
Configure tests
1 parent 4977dd6 commit 75ac183

15 files changed

+138
-4
lines changed

Diff for: .github/workflows/build.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
validate:
8+
name: validate
9+
runs-on: ubuntu-latest
10+
outputs:
11+
matrix: |
12+
{
13+
"dir": ${{ steps.set-matrix.outputs.dirs }}
14+
}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Validate
20+
uses: pre-commit/[email protected]
21+
22+
- name: Configure matrix for test
23+
id: set-matrix
24+
run: |
25+
DIRS=$(find . -type f -name 'docker-compose.yml' -exec dirname "{}" \; | sort -u | jq -R | jq -s -c)
26+
echo "dirs=${DIRS}" >> "$GITHUB_OUTPUT"
27+
28+
29+
test:
30+
name: test
31+
runs-on: ubuntu-latest
32+
needs: validate
33+
strategy:
34+
matrix: ${{ fromJson(needs.validate.outputs.matrix) }}
35+
fail-fast: false
36+
max-parallel: 15
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- uses: docker/setup-buildx-action@v3
41+
42+
- name: Run containers
43+
timeout-minutes: 10
44+
working-directory: ${{ matrix.dir }}
45+
run: |
46+
docker compose -f up -d --wait
47+
48+
- name: Stop containers
49+
if: always()
50+
working-directory: ${{ matrix.dir }}
51+
run: |
52+
docker compose down -v
53+
54+

Diff for: README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
[![Build](https://github.com/Romanow/docker-compose-examples/actions/workflows/build.yaml/badge.svg?branch=master)](https://github.com/Romanow/docker-compose-examples/actions/workflows/build.yaml)
2+
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
3+
14
# Docker Compose examples
25

36
* [Kafka](kafka/README.md)
47
* [Monitoring](monitoring/README.md)
58
* [Postgres](postgres/README.md)
69
* [Logging](logging/README.md)
7-
* [ElasticSearch](elastic/README.md)
10+
* [Tracing](tracing/README.md)
11+
* [Elastic](elastic/README.md)
12+
* [Frontend](frontend/README.md)
13+
* [Java](java/README.md)

Diff for: elastic/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# ElasticSearch
22

3-
* [Single Node](docker-compose.single-node.yml)
3+
* [Single Node](docker-compose.yml)
File renamed without changes.

Diff for: frontend/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Frontend

Diff for: frontend/docker-compose.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
simple-frontend:
3+
image: "romanowalex/simple-frontend:v2.0"
4+
container_name: simple-frontend
5+
ports:
6+
- "8080:80"
7+
healthcheck:
8+
test: "curl --fail http://localhost || exit 1"
9+
interval: 5s
10+
timeout: 3s
11+
retries: 5

Diff for: java/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Java

Diff for: java/builders/build.dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM amazoncorretto:17 AS builder
2+
3+
WORKDIR application
4+
COPY . .
5+
6+
RUN ./gradlew clean assemble && \
7+
mv build/libs/camunda-base.jar application.jar && \
8+
java -Djarmode=layertools -jar application.jar extract
9+
10+
FROM amazoncorretto:17
11+
12+
ENV JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=75.0"
13+
14+
WORKDIR application
15+
COPY --from=builder application/spring-boot-loader/ ./
16+
COPY --from=builder application/dependencies/ ./
17+
COPY --from=builder application/snapshot-dependencies/ ./
18+
COPY --from=builder application/application/ ./
19+
20+
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]

Diff for: java/builders/main.dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM amazoncorretto:17 AS builder
2+
3+
WORKDIR application
4+
5+
ARG JAR_FILE=build/libs/echo-server.jar
6+
COPY ${JAR_FILE} application.jar
7+
8+
RUN java -Djarmode=layertools -jar application.jar extract
9+
10+
FROM amazoncorretto:17
11+
12+
ENV JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=75.0"
13+
14+
WORKDIR application
15+
16+
COPY --from=builder application/spring-boot-loader/ ./
17+
COPY --from=builder application/dependencies/ ./
18+
COPY --from=builder application/snapshot-dependencies/ ./
19+
COPY --from=builder application/application/ ./
20+
21+
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]

Diff for: java/docker-compose.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3.9"
2+
services:
3+
echo-server:
4+
image: romanowalex/echo-server:v2.0
5+
container_name: echo-server
6+
environment:
7+
SPRING_PROFILES_ACTIVE: simple
8+
ports:
9+
- "8080:8080"
10+
healthcheck:
11+
test: [ "CMD", "curl", "--silent", "--fail", "http://localhost:8080/manage/health" ]
12+
interval: 5s
13+
timeout: 5s
14+
retries: 5

Diff for: kafka/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Kafka and Zookeeper
22

3-
* [Single Node](docker-compose.standalone.yml)
3+
* [Single Node](docker-compose.yml)
File renamed without changes.

Diff for: test.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
4+
5+
docker compose -f docker-compose.single-node.yml up -d --wait
6+
docker compose -f docker-compose.single-node.yml down -v

Diff for: tracing/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Jaeger Tracing
22

3-
* [All-In-One](docker-compose.all-in-one.yml)
3+
* [All-In-One](docker-compose.yml)
File renamed without changes.

0 commit comments

Comments
 (0)