Skip to content
Merged
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
48 changes: 3 additions & 45 deletions .github/workflows/instances.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@ jobs:
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
java-version: '17'
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Copy Maven settings for Docker
run: |
mkdir -p .m2
cp ~/.m2/settings.xml .m2/settings.xml

- name: Convert repository name to lowercase
run: echo "IMAGE_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

Expand Down Expand Up @@ -108,6 +93,7 @@ jobs:
with:
context: .
push: true
no-cache: true
build-args: ${{ env.BUILD_ARGS }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }}-mug
Expand All @@ -126,21 +112,6 @@ jobs:
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
java-version: '17'
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Copy Maven settings for Docker
run: |
mkdir -p .m2
cp ~/.m2/settings.xml .m2/settings.xml

- name: Convert repository name to lowercase
run: echo "IMAGE_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

Expand Down Expand Up @@ -184,6 +155,7 @@ jobs:
with:
context: .
push: true
no-cache: true
build-args: ${{ env.BUILD_ARGS }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }}-tug
Expand All @@ -202,21 +174,6 @@ jobs:
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
java-version: '17'
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Copy Maven settings for Docker
run: |
mkdir -p .m2
cp ~/.m2/settings.xml .m2/settings.xml

- name: Convert repository name to lowercase
run: echo "IMAGE_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

Expand Down Expand Up @@ -260,6 +217,7 @@ jobs:
with:
context: .
push: true
no-cache: true
build-args: ${{ env.BUILD_ARGS }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }}-jku
Expand Down
29 changes: 17 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# STAGE 1: BUILD STAGE
# Build the application using Maven in an Alpine-based container
#==============================================================================
FROM maven:3.9.5-eclipse-temurin-17-alpine AS builder
FROM maven:3.9.5-eclipse-temurin-17 AS builder

ARG BUILD_HOME=/home/app
ARG BUILD_PROFILE=postgres
Expand All @@ -17,18 +17,22 @@ ARG DAMAP_BASE_VERSION
# build directories with proper permissions for non-root user
RUN mkdir $BUILD_HOME && \
mkdir -p $BUILD_HOME/.m2/repository && \
mkdir -p $BUILD_HOME/instances/${INSTANCE_NAME} && \
chown -R 1000:0 $BUILD_HOME

# Switch to non-root user for security
USER 1000
WORKDIR $BUILD_HOME
# Copy parent POM to correct location (../../pom.xml from instances/INSTANCE/pom.xml)
COPY pom.xml $BUILD_HOME/pom.xml

# copies from instances/${INSTANCE_NAME}/ directory
COPY instances/${INSTANCE_NAME}/src ./src
COPY instances/${INSTANCE_NAME}/pom.xml .
COPY instances/${INSTANCE_NAME}/src $BUILD_HOME/instances/${INSTANCE_NAME}/src
COPY instances/${INSTANCE_NAME}/pom.xml $BUILD_HOME/instances/${INSTANCE_NAME}/

# Fix ownership after copying
RUN chown -R 1000:0 $BUILD_HOME

# Copy Maven settings.xml for GitHub Packages authentication
COPY .m2/settings.xml $BUILD_HOME/.m2/settings.xml
# Switch to non-root user for security
USER 1000
WORKDIR $BUILD_HOME/instances/${INSTANCE_NAME}

# Maven repository volume for caching dependencies
VOLUME ["/home/app/.m2/repository"]
Expand All @@ -49,6 +53,7 @@ FROM rockylinux:8.5 AS runner
ARG JAVA_PACKAGE=java-17-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8
ARG BUILD_HOME=/home/app
ARG INSTANCE_NAME

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

Expand All @@ -71,10 +76,10 @@ RUN dnf install -y openssl tzdata-java curl ca-certificates ${JAVA_PACKAGE} && \
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Duser.home=/deployments"

# copy compiled application from builder stage
COPY --from=builder $BUILD_HOME/target/quarkus-app/lib/ /deployments/lib/
COPY --from=builder $BUILD_HOME/target/quarkus-app/*.jar /deployments/
COPY --from=builder $BUILD_HOME/target/quarkus-app/app/ /deployments/app/
COPY --from=builder $BUILD_HOME/target/quarkus-app/quarkus/ /deployments/quarkus/
COPY --from=builder $BUILD_HOME/instances/${INSTANCE_NAME}/target/quarkus-app/lib/ /deployments/lib/
COPY --from=builder $BUILD_HOME/instances/${INSTANCE_NAME}/target/quarkus-app/*.jar /deployments/
COPY --from=builder $BUILD_HOME/instances/${INSTANCE_NAME}/target/quarkus-app/app/ /deployments/app/
COPY --from=builder $BUILD_HOME/instances/${INSTANCE_NAME}/target/quarkus-app/quarkus/ /deployments/quarkus/

# expose application port
EXPOSE 8080
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ docker build --platform linux/amd64 --build-arg INSTANCE_NAME=MUG -t damap-backe
docker build --platform linux/amd64 --build-arg INSTANCE_NAME=JKU -t damap-backend-jku .
```

# Test build - Wed Jul 23 16:01:47 CEST 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed in the readme?

Copy link
Contributor Author

@lpandath lpandath Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, i needed new fresh commit for the cache build issues which i tried with the package. Can remove it in the end!

17 changes: 4 additions & 13 deletions docs/VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ We use a **Parent POM approach** combined with **CI/CD flexibility** to manage `
### Parent POM (`pom.xml`)
- **Central version management** for `damap-base` dependency
- **Instance-specific defaults**:
- **TUG**: `0.0.0-SNAPSHOT` (follows upstream development)
- **TUG**: `4.6.1` (latest stable release)
- **MUG**: `4.5.2` (stable version)
- **JKU**: `4.4.0` (stable version)
- **Profiles** for different scenarios:
- `use-latest-release`: Uses stable released version (4.6.1)
- `production`: Production-ready version

### Instance POMs (TUG, MUG, JKU)
- **Inherit** from parent POM
Expand All @@ -30,18 +27,12 @@ We use a **Parent POM approach** combined with **CI/CD flexibility** to manage `

## Usage scenarios

### Default Behavior (Instance-specific)
### Standard Build (Instance-specific versions)
```bash
# TUG uses SNAPSHOT, MUG uses 4.5.2, JKU uses 4.4.0
# TUG uses 4.6.1, MUG uses 4.5.2, JKU uses 4.4.0
mvn clean package
```

### Use Latest Release
```bash
# Uses stable release version
mvn clean package -Puse-latest-release
```

### Override Version in CI/CD
```bash
# Specify custom version
Expand Down Expand Up @@ -78,7 +69,7 @@ mvn clean package -Ddamap.base.version=4.7.0

#### Development Build
```yaml
# Uses SNAPSHOT version from parent POM
# Uses stable versions from parent POM
- Trigger: Push to main
- Result: Images tagged with "main"
```
Expand Down
174 changes: 67 additions & 107 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,118 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.damap</groupId>
<artifactId>damap-instances-parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<groupId>org.damap</groupId>
<artifactId>damap-instances-parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>

<name>DAMAP Instances Parent</name>
<description>Parent POM for all DAMAP instance projects (TUG, MUG, JKU, etc.)</description>
<name>DAMAP Instances Parent</name>
<description>Parent POM for all DAMAP instance projects (TUG, MUG, JKU, etc.)</description>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Default base version - can be overridden in child POMs or via -D property -->
<damap.base.version>0.0.0-SNAPSHOT</damap.base.version>

<!-- Instance-specific stable versions -->
<damap.base.version.tug>0.0.0-SNAPSHOT</damap.base.version.tug>
<damap.base.version.mug>4.5.2</damap.base.version.mug>
<damap.base.version.jku>4.4.0</damap.base.version.jku>

<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.version>3.11.1</quarkus.platform.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
</properties>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<repositories>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/damap-org/damap-backend</url>
</repository>
</repositories>
<!-- Instance-specific DAMAP base versions -->
<damap.base.version.tug>4.6.1</damap.base.version.tug>
<damap.base.version.mug>4.5.2</damap.base.version.mug>
<damap.base.version.jku>4.4.0</damap.base.version.jku>

<!-- Quarkus platform version -->
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.version>3.11.1</quarkus.platform.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
</properties>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/damap-org/damap-backend</url>
</repository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<!-- Quarkus BOM -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<!-- DAMAP Base dependency management -->
<dependency>
<groupId>org.damap</groupId>
<artifactId>base</artifactId>
<version>${damap.base.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencyManagement>
<dependencies>
<!-- Quarkus BOM -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<!-- DAMAP Base - central version management -->
<dependency>
<groupId>org.damap</groupId>
<artifactId>base</artifactId>
<version>${damap.base.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<parameters>${maven.compiler.parameters}</parameters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.3</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<parameters>${maven.compiler.parameters}</parameters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.3</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<modules>
<module>instances/TUG</module>
<module>instances/MUG</module>
<module>instances/JKU</module>
</modules>

<profiles>
<!-- Profile to use latest released version instead of SNAPSHOT -->
<profile>
<id>use-latest-release</id>
<properties>
<damap.base.version>4.6.1</damap.base.version>
</properties>
</profile>

<!-- Profile for production builds -->
<profile>
<id>production</id>
<properties>
<damap.base.version>4.6.1</damap.base.version>
</properties>
</profile>
</profiles>
</project>
Loading