<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abassi Sabri</title>
    <description>The latest articles on DEV Community by Abassi Sabri (@sabriabassi).</description>
    <link>https://dev.to/sabriabassi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1367075%2Fbcb0e247-8cb6-40d1-b0af-8f8ab4b75056.png</url>
      <title>DEV Community: Abassi Sabri</title>
      <link>https://dev.to/sabriabassi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sabriabassi"/>
    <language>en</language>
    <item>
      <title>Crafting Docker Containers for Your Spring Boot Applications</title>
      <dc:creator>Abassi Sabri</dc:creator>
      <pubDate>Wed, 27 Mar 2024 00:43:51 +0000</pubDate>
      <link>https://dev.to/sabriabassi/crafting-docker-containers-for-your-spring-boot-applications-2mmo</link>
      <guid>https://dev.to/sabriabassi/crafting-docker-containers-for-your-spring-boot-applications-2mmo</guid>
      <description>&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;Docker containers offer a lightweight and portable way to package and deploy your Spring Boot applications. This article guides you through the essential steps of creating a Docker container for your Spring Boot project, enabling you to streamline your development and deployment workflows.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Docker installed and running on your system. &lt;a href="https://docs.docker.com/engine/install/"&gt;Here !&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A Spring Boot project with a generated executable JAR file (typically located in target/ directory).&lt;/li&gt;
&lt;li&gt;Basic understanding of Docker concepts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Create a Dockerfile:
&lt;/h3&gt;

&lt;p&gt;In the root directory of your Spring Boot project, create a plain text file named Dockerfile. This file specifies the instructions for building your Docker image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcmg9f9tscpxy0qwdopw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcmg9f9tscpxy0qwdopw.png" alt="Spring boot" width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Define the Base Image:
&lt;/h3&gt;

&lt;p&gt;The first line in your Dockerfile specifies the base image upon which your Spring Boot application will run. A common choice is openjdk:21-slim (or a similar JDK version) as it provides a lightweight Java runtime environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Dockerfile
FROM openjdk:21-slim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Copy the JAR File:
&lt;/h3&gt;

&lt;p&gt;Use the COPY instruction to copy your Spring Boot application's JAR file from your project directory to a suitable location within the container image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Dockerfile
FROM openjdk:21-slim

ARG JAR_FILE=target/*.jar

COPY ${JAR_FILE} app.jar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Define the Entrypoint:
&lt;/h3&gt;

&lt;p&gt;The ENTRYPOINT instruction specifies the command to be executed when the container starts. If your Spring Boot application has a main method, you can use the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Dockerfile
FROM openjdk:21-slim

ARG JAR_FILE=target/*.jar

COPY ${JAR_FILE} app.jar

ENTRYPOINT ["java", "-jar", "app.jar"]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Build Docker Image :
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t &amp;lt;image-name&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hfmogc4qcflieidyye5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hfmogc4qcflieidyye5.png" alt="Image build" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Check The list of images :
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker images
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq9a57g7o8k9ks190pw5d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq9a57g7o8k9ks190pw5d.png" alt="Docker images" width="800" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Run the Container:
&lt;/h3&gt;

&lt;p&gt;Use the docker run command to start a container from your newly built image. Here's the basic syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d -p &amp;lt;host-port&amp;gt;:&amp;lt;container-port&amp;gt; &amp;lt;image-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;host-port: The port on your host machine that will be mapped to the container's application port (usually the default Spring Boot port, 8080).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;container-port : The port within the container that your application listens on (defaults to 8080 for Spring Boot).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;image-name: The name of your Docker image created.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; docker run -d -p 8081:8081 --name test-microservice test-image

 docker ps # list of running containers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfoay19kz5nykpnfqg6q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfoay19kz5nykpnfqg6q.png" alt="running container" width="800" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thx For Reading!&lt;/p&gt;

</description>
      <category>springboot</category>
      <category>docker</category>
      <category>microservices</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Manage Git Branches for Jira Tickets in IntelliJ IDEA</title>
      <dc:creator>Abassi Sabri</dc:creator>
      <pubDate>Tue, 26 Mar 2024 23:05:40 +0000</pubDate>
      <link>https://dev.to/sabriabassi/how-to-manage-git-branches-for-jira-tickets-in-intellij-idea-30k6</link>
      <guid>https://dev.to/sabriabassi/how-to-manage-git-branches-for-jira-tickets-in-intellij-idea-30k6</guid>
      <description>&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;This tutorial guides you through effectively managing Git branches for your Jira tickets using IntelliJ IDEA. This approach streamlines collaboration, tracks changes, and ensures a clean development workflow.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Basic understanding of Git commands&lt;/li&gt;
&lt;li&gt;Project connected to a Git repository (e.g., GitHub, GitLab)&lt;/li&gt;
&lt;li&gt;Active Jira account with a project integrated with your Git repository (optional but highly recommended)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Creating a Branch per Jira Ticket
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the Version Control (VCS) Menu: In IntelliJ IDEA, navigate to Git &amp;gt;.&lt;/li&gt;
&lt;li&gt;Create a New Branch: Select New Branch.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Name Your Branch: Use a descriptive naming convention reflecting the Jira ticket. &lt;br&gt;
A common pattern is feature/-, for example, feature/ABC-123-add-user-login. This practice improves clarity and traceability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checkout the New Branch: Select Checkout to start working on your changes in the new branch. This isolates your development from the main codebase.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Equivalent Git Commands :&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b feature/ABC-123-add-user-login  # Creates and switches to the new branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Making Changes and Committing
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Code Edits: Make your code modifications related to the Jira ticket in the designated branch.&lt;/li&gt;
&lt;li&gt;Commit Your Changes: When ready, go to Git &amp;gt; Commit or use the commit icon in the toolbar. &lt;/li&gt;
&lt;li&gt;Write a Clear Commit Message: Describe your changes concisely, often referencing the Jira ticket ID for easier tracking. A good format follows the conventional style: (): . Example: fix(ABC-123): Implemented user login functionality.&lt;/li&gt;
&lt;li&gt;Pushing Changes to Remote Repository :
Push to Remote Repository: If you're collaborating with others and want to share your local branch, go to Git &amp;gt; Push. Select the remote repository and the branch you want to push to (usually origin and your branch name).&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Equivalent Git Commands :&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add modified-file-1 modified-file-2 
git commit -m "Message"
git push origin feature/ABC-123-add-user-login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Merging into main after validation
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkbvmfxfv5iya9tdr7ar9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkbvmfxfv5iya9tdr7ar9.png" alt="Merge feature into main" width="657" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've completed work on your feature branch, received validation/testing approval, it's time to integrate your changes into the main branch. Here's how to achieve this :&lt;/p&gt;

&lt;p&gt;Let's startby downloading the latest changes from the remote repository, then switching to the main branch for local work :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git fetch &amp;amp;&amp;amp; git checkout main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now Merge the feature branch into you main branch ! (If there is a conflict resolve it then remerge).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcy2y3um7b1o81z2phiv8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcy2y3um7b1o81z2phiv8.png" alt="Git merge with Intellij" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>git</category>
      <category>jira</category>
      <category>intellij</category>
      <category>merge</category>
    </item>
  </channel>
</rss>
