From fc37c04ccd250bf4cdd028c633201da2f8d9ad79 Mon Sep 17 00:00:00 2001 From: Fathzer Date: Thu, 10 Sep 2026 20:30:04 +0200 Subject: [PATCH 1/6] Updates GitHub Actions workflows and restructures project to launcher subdirectory. Adds --- .github/workflows/build.yml | 9 +-- .gitignore | 4 +- Dockerfile | 13 +++-- README.md | 18 +++++- pom.xml => launcher/pom.xml | 56 +++++++------------ .../fathzer/jdbbackup/cron/Configuration.java | 0 .../fathzer/jdbbackup/cron/Destination.java | 2 +- .../java/com/fathzer/jdbbackup/cron/Main.java | 0 .../jdbbackup/cron/PluginsManager.java | 0 .../jdbbackup/cron/parameters/Task.java | 0 .../plugindownloader/RepositoryRecord.java | 0 .../SharedRepositoryDownloader.java | 0 .../com/fathzer/jdbbackup/utils/Cache.java | 0 .../src}/main/resources/logback.xml | 0 .../src}/main/resources/version.txt | 0 .../java/com/fathzer/jdbbackup/TestIT.java | 0 .../jdbbackup/cron/ConfigurationTest.java | 0 .../jdbbackup/cron/parameters/TaskTest.java | 0 18 files changed, 51 insertions(+), 51 deletions(-) rename pom.xml => launcher/pom.xml (79%) rename {src => launcher/src}/main/java/com/fathzer/jdbbackup/cron/Configuration.java (100%) rename {src => launcher/src}/main/java/com/fathzer/jdbbackup/cron/Destination.java (94%) rename {src => launcher/src}/main/java/com/fathzer/jdbbackup/cron/Main.java (100%) rename {src => launcher/src}/main/java/com/fathzer/jdbbackup/cron/PluginsManager.java (100%) rename {src => launcher/src}/main/java/com/fathzer/jdbbackup/cron/parameters/Task.java (100%) rename {src => launcher/src}/main/java/com/fathzer/jdbbackup/cron/plugindownloader/RepositoryRecord.java (100%) rename {src => launcher/src}/main/java/com/fathzer/jdbbackup/cron/plugindownloader/SharedRepositoryDownloader.java (100%) rename {src => launcher/src}/main/java/com/fathzer/jdbbackup/utils/Cache.java (100%) rename {src => launcher/src}/main/resources/logback.xml (100%) rename {src => launcher/src}/main/resources/version.txt (100%) rename {src => launcher/src}/test/java/com/fathzer/jdbbackup/TestIT.java (100%) rename {src => launcher/src}/test/java/com/fathzer/jdbbackup/cron/ConfigurationTest.java (100%) rename {src => launcher/src}/test/java/com/fathzer/jdbbackup/cron/parameters/TaskTest.java (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c1142a..a4dd528 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,27 +10,28 @@ jobs: name: Build and analyze runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Set up JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v6 with: java-version: 11 distribution: 'zulu' # Alternative distribution options are available. - name: Cache SonarCloud packages - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Cache Maven packages - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - name: Build and analyze + working-directory: launcher env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.gitignore b/.gitignore index 0c837c9..9745681 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ target/ .settings/ dependency-reduced-pom.xml -/.classpath -/.project +.classpath +.project diff --git a/Dockerfile b/Dockerfile index 7e837ad..864c817 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,16 @@ -FROM openjdk:11-jre +ARG JAVA_BASE_IMAGE=eclipse-temurin:25.0.4_7-jre +FROM ${JAVA_BASE_IMAGE} -RUN apt-get update && apt-get install -y default-mysql-client -RUN apt-get clean +RUN apt-get update && apt-get install -y default-mysql-client && apt-get clean -ENV RUN_USER jdbbackup -ENV RUN_GROUP jdbbackup +ENV RUN_USER=jdbbackup +ENV RUN_GROUP=jdbbackup RUN groupadd -r ${RUN_GROUP} && useradd -g ${RUN_GROUP} -m -s /bin/bash ${RUN_USER} WORKDIR /home/${RUN_USER} -COPY target/jdbbackup.jar . +ARG JAR_FILE +COPY ${JAR_FILE} jdbbackup.jar RUN chown -R ${RUN_USER}:${RUN_USER} . USER ${RUN_USER} diff --git a/README.md b/README.md index d50421a..e26ef6b 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ A ready to use docker container, based on [jdbbackup-core](https://github.com/jd ### Without Docker This application requires Java11+. -The [artifact deployed in Maven central](https://repo1.maven.org/maven2/com/fathzer/jdbbackup-docker/1.0.0/jdbbackup-docker-1.0.0.jar) is a runnable jar. -Launch it with ```java -jar jdbbackup-docker-1.0.0.jar config.json``` where *config.json* is the configuration file ([see below](#configuration-file)) or set the environment variable *TASKS_PATH* to the path of the configuration file and launch it with ```java -jar jdbbackup-docker-1.0.0.jar```. You may also leave *TASKS_PATH* unset, its default value is *tasks.json*. +The [artifact deployed in Maven central](https://repo1.maven.org/maven2/com/fathzer/jdbbackup-docker/1.1.0/jdbbackup-docker-1.1.0.jar) is a runnable jar. +Launch it with ```java -jar jdbbackup-docker-1.1.0.jar config.json``` where *config.json* is the configuration file ([see below](#configuration-file)) or set the environment variable *TASKS_PATH* to the path of the configuration file and launch it with ```java -jar jdbbackup-docker-1.1.0.jar```. You may also leave *TASKS_PATH* unset, its default value is *tasks.json*. If you want to include this application in a Java program, the main class is *com.fathzer.jdbbackup.cron.Main*. @@ -96,6 +96,18 @@ The default configuration logs to the console, rejecting entries below *info* le If you want to change logback configuration, please have a look at [the logback manual](https://logback.qos.ch/manual/configuration.html). # Developer notes -- How to build the Docker image?: ```mvn package -Pdocker``` +- Build the jar: + ```bash + cd launcher + mvn package -DskipTests + ``` +- Build the Docker image (from the repository root): + + ```bash + docker build -t fathzer/db-backup:1.1.0-jre-25.0.4 --build-arg JAVA_BASE_IMAGE=eclipse-temurin:25.0.4_7-jre --build-arg JAR_FILE=launcher/target/jdbbackup.jar . + ``` + The `JAVA_BASE_IMAGE` build arg sets the base JRE image. The `JAR_FILE` build arg points to the jar relative to the repository root (the Docker context). + + > **Warning**: do not push the built image to Docker Hub unless you're sure about the tag format; it may not follow the naming convention used by the official images. diff --git a/pom.xml b/launcher/pom.xml similarity index 79% rename from pom.xml rename to launcher/pom.xml index e5d699d..95ba5ef 100644 --- a/pom.xml +++ b/launcher/pom.xml @@ -3,15 +3,11 @@ com.fathzer parent-pom - 1.0.8 + 1.1.0 jdbbackup-docker - 1.0.0 - A simple java library to perform data source backup and store them in dropbox, sftp or local file - - https://github.com/jdbbackup/jdbbackup-dropbox.git - https://github.com/jdbbackup/jdbbackup-dropbox.git - + 1.1.0 + UTF-8 11 @@ -19,6 +15,7 @@ ${maven.compiler.target} ${maven.compiler.target} jdbbackup + 1.18.48 @@ -29,29 +26,6 @@ jdbbackup - - - com.spotify - dockerfile-maven-plugin - 1.4.13 - - - default - - build - push - - - - - fathzer/db-backup - ${project.version} - - target/${project.build.finalName}.jar - - - - @@ -60,7 +34,7 @@ com.fathzer jdbbackup-core - 1.0.0 + 1.1.0