Skip to content

Copy env variables to new docker properties for deploying in Linux/Docker #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 17, 2025

Conversation

drtechie
Copy link
Member

@drtechie drtechie commented Jun 12, 2025

📋 Description

JIRA ID: AMM-1625
Proposed Changes:

  • Create a docker properties file which is a copy of ci properties.
  • The file uses ${} to ensure environment variables inside the system is used instead of injecting from Jenkins - used for Linux and Docker deployments

✅ Type of Change

  • ⚙️ Config change (configuration file or build script updates)

Summary by CodeRabbit

  • New Features

    • Added a new configuration file for Docker-based deployments, enabling environment-specific settings for databases, APIs, schedulers, authentication, logging, and integrations.
    • Introduced new configuration options for captcha functionality.
    • Updated environment configurations to support production settings and dynamic Redis host assignment.
  • Chores

    • Updated the Docker setup to use a multi-stage build for improved efficiency and smaller runtime images.
    • Enhanced build configuration to better manage dependencies and plugin executions.

Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

Walkthrough

A multi-stage Dockerfile is introduced for building and running a Java application, a new Docker-specific environment properties file is added, and the pom.xml is updated to refine plugin configuration and dependency exclusions. The CI environment properties are updated to use environment variables, set production mode, and include CORS and captcha properties with an unresolved merge conflict.

Changes

File(s) Change Summary
Dockerfile Added a multi-stage build and runtime Dockerfile for Java application deployment.
pom.xml Excluded spring-boot-starter-logging and explicitly configured spring-boot-maven-plugin with repackage goal and version.
src/main/environment/common_ci.properties Changed Redis host to environment variable, set production flag to true, added CORS and captcha properties with merge conflict markers.
src/main/environment/common_docker.properties Added a new Docker environment properties file with placeholders for database, APIs, schedulers, auth, logging, and external integrations.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Docker Build (Maven)
    participant Docker Runtime (JRE)
    participant Application

    Developer->>Docker Build (Maven): Build image (copy source, run Maven package)
    Docker Build (Maven)->>Docker Runtime (JRE): Copy WAR file to runtime image
    Developer->>Docker Runtime (JRE): Start container (java -jar app.war)
    Docker Runtime (JRE)->>Application: Run application on port 8080
Loading

Possibly related PRs

  • PSMRI/Common-API#191: Introduces the same multi-stage Dockerfile and identical pom.xml changes, plus the same common_docker.properties file, indicating a direct code-level connection.

Poem

🐇
A Dockerfile new, so clean and bright,
With configs for day and for night.
Captcha secrets now in place,
Plugins set for the Maven race.
In containers we now reside,
With properties and code inside!
— Hopping onward, side by side.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a7f7aa and d28fdcf.

📒 Files selected for processing (1)
  • pom.xml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pom.xml
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build
  • GitHub Check: Analyze (java)
  • GitHub Check: Package-test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (3)
src/main/environment/common_ci.properties (1)

1-182: Ensure newline at end of file
Add an empty newline at EOF to satisfy POSIX conventions and avoid issues with some editors or tools.

Dockerfile (2)

9-11: Optimize Docker layer caching
Reorder the COPY/RUN steps to download dependencies before copying the full source tree. This reduces rebuild times when code changes but dependencies do not.


17-22: Pin JRE base image tag
Consider using a fully qualified tag or digest (e.g. eclipse-temurin:17-jre-jammy) to ensure reproducible builds instead of the moving :17-jre.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d140c98 and e26a802.

📒 Files selected for processing (4)
  • Dockerfile (1 hunks)
  • pom.xml (2 hunks)
  • src/main/environment/common_ci.properties (1 hunks)
  • src/main/environment/common_docker.properties (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build
  • GitHub Check: Analyze (java)
  • GitHub Check: Package-test
🔇 Additional comments (2)
pom.xml (1)

62-65: Validate exclusion of default logging starter
You’ve excluded spring-boot-starter-logging from the core starter. Ensure an alternative logging implementation is provided and that no required logging classes are inadvertently omitted.

src/main/environment/common_docker.properties (1)

165-167: Verify captcha placeholders resolution
The captcha keys use ${...} syntax; confirm that the Maven filtering or Docker entrypoint will replace them properly at runtime.

Comment on lines +661 to +672
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consolidate duplicate Spring Boot Maven plugin
There are two <plugin> entries for spring-boot-maven-plugin (one without version at lines 511–514 and another with version at 661–672). Merge them into a single declaration with the <version> and <execution> to avoid redundancy.

Apply this diff in the <plugins> section:

-    <plugin>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-maven-plugin</artifactId>
-    </plugin>
+    <plugin>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-maven-plugin</artifactId>
+      <version>3.2.2</version>
+      <executions>
+        <execution>
+          <goals>
+            <goal>repackage</goal>
+          </goals>
+        </execution>
+      </executions>
+    </plugin>
🤖 Prompt for AI Agents
In pom.xml around lines 511-514 and 661-672, there are two separate declarations
of the spring-boot-maven-plugin, one without a version and one with version
3.2.2 and execution configuration. Merge these two plugin entries into a single
plugin declaration that includes the version 3.2.2 and the execution block with
the repackage goal, removing the duplicate plugin entry to avoid redundancy.

Comment on lines +59 to +60
---------------------------
fileBasePath =${MMU_FILE_BASE_PATH}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove non-property separator
The dash line (---------------------------) isn’t a valid key/value entry and will break parsing. Please delete it.

🤖 Prompt for AI Agents
In src/main/environment/common_docker.properties at lines 59 to 60, remove the
line containing only dashes (---------------------------) as it is not a valid
property entry and will cause parsing errors. Ensure the file only contains
valid key=value pairs without any separator lines.

Copy link
Contributor

@vanitha1822 vanitha1822 left a comment

Choose a reason for hiding this comment

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

@drtechie Please remove the conflict markers and duplicate plugins in pom.xml file.

@drtechie drtechie changed the title fix: add empty line to end of CI file Copy env variables to new docker properties for deploying in Linux/Docker Jun 12, 2025
vanitha1822
vanitha1822 previously approved these changes Jun 17, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
src/main/environment/common_ci.properties (1)

180-185: Remove unresolved merge conflict markers

The conflict markers (<<<<<<<, =======, >>>>>>>) break the properties file syntax. Remove them and retain only:

cors.allowed-origins[email protected]_ALLOWED_ORIGINS@
🧹 Nitpick comments (1)
src/main/environment/common_ci.properties (1)

64-66: Consistent naming for file Base Path property

This key is defined in camelCase (fileBasePath) unlike the kebab-case and dot-notation style used elsewhere. Consider renaming it to file-base-path or file.base-path to maintain consistency across properties.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e26a802 and 4a7f7aa.

📒 Files selected for processing (2)
  • src/main/environment/common_ci.properties (3 hunks)
  • src/main/environment/common_docker.properties (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/environment/common_docker.properties
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Package-test
  • GitHub Check: Analyze (java)
  • GitHub Check: Build
🔇 Additional comments (2)
src/main/environment/common_ci.properties (2)

68-68: Approve Redis host placeholder update

Switching from a hardcoded localhost to @env.REDIS_HOST@ enables external configuration for different deployments.


170-170: Verify isProduction flag value for CI environment

Setting isProduction=true in the CI properties may cause CI runs to be treated as production. Confirm that this aligns with the intended environment semantics and downstream code logic.

Copy link

@drtechie drtechie merged commit 9a835d1 into develop Jun 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants