From cc951cc53247470719cdd0860506f4a9683a11e9 Mon Sep 17 00:00:00 2001 From: AlyanQureshi <144194260+AlyanQureshi@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:09:41 -0600 Subject: [PATCH 1/7] creating dockerfile --- Dockerfile | 1 + docs/BDD_video.mp4 | Bin 12191007 -> 12191004 bytes 2 files changed, 1 insertion(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ddcbee61 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +# created a docker file \ No newline at end of file diff --git a/docs/BDD_video.mp4 b/docs/BDD_video.mp4 index 27c4646cf01956f75756fca4569d3aedbc1417d6..571239ede95cfe30e98aab42f099e7dc7eba9064 100644 GIT binary patch delta 665 zcmWN=*;$oTM0_k9wjMRd$n&N#bVm6W(xQ701wha zD-ZE7Q+b4GOlJl&d6dVP#cbyAI8X2-b9st+Jk2va%X2)>d|qGyFY*!#S;S(Nu#{yi z=Ve}D1+TKwu$ooQ5WCw|Ww>3{|GeyurD|T|b=L3(Ygxy7-sCOb<{dWhF7L6C_u0f| zK41%5`H+wJm`~Wor?l}I+xeVg2Vc<6m+WL0yV=8D_VE?_`I>L|mhbqU1N^{24snGpG55U-^yS`GY?>!(W`GgTFb)Kb+?Rom`~BzlLMUY=~b5bj@Sp delta 671 zcmWO1*)|ja0Eh827)vOHqD7I&(qgGbo61fhlvF~9HcM2tGV*7bN~J7ig!UMfqG_&r z2Y2%Z-OM}mUHs1ZZaLbXww z6sB-())sBmHbrQ=b|_L&+No&mQjB7?TXBk4f)ceyd$mvdm84{)ET@{BhCqwSnTi8A zh(ji!EK`F{`4(Cyh3#hf5QbsJV?4oAjNlob;{`_X60b0ZaZF$m zuki*`uwfc+F@ssm;T_)N13uytKI03%Vjc^yV-er*9Y3&ypZJAktl&2s_~Wp Date: Fri, 14 Mar 2025 14:15:35 -0600 Subject: [PATCH 2/7] adding jdk version and setting workdirectory --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ddcbee61..44e8ab3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1,6 @@ -# created a docker file \ No newline at end of file +# using slim cuz its more lightweight than the normal jdk +FROM openjdk:17-jdk-slim + +# default directory going to be desktop_app +WORKDIR /desktop_app + From a43463ddd204ab598e63ff80eed6787187684cdd Mon Sep 17 00:00:00 2001 From: AlyanQureshi <144194260+AlyanQureshi@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:22:37 -0600 Subject: [PATCH 3/7] writing commands to install dependencies --- Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index 44e8ab3b..a3efd95c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,3 +4,10 @@ FROM openjdk:17-jdk-slim # default directory going to be desktop_app WORKDIR /desktop_app +RUN apt-get update + +# installing necessary dependencies +RUN apt-get install -y python3 +RUN apt-get install -y python3-pip +RUN apt-get install -y curl +RUN apt-get install -y unzip \ No newline at end of file From 065076d760a6ebc4af4bb6888c676f524d811a91 Mon Sep 17 00:00:00 2001 From: AlyanQureshi <144194260+AlyanQureshi@users.noreply.github.com> Date: Sat, 15 Mar 2025 11:06:56 -0600 Subject: [PATCH 4/7] adding command to reduce image size --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a3efd95c..77568444 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,7 @@ RUN apt-get update RUN apt-get install -y python3 RUN apt-get install -y python3-pip RUN apt-get install -y curl -RUN apt-get install -y unzip \ No newline at end of file +RUN apt-get install -y unzip + +# cleaning up the cache to make the imahe as small as possible +RUN apt-get clean \ No newline at end of file From 18580c3e84247b4d2f460bc6e171d51949141e93 Mon Sep 17 00:00:00 2001 From: JaisumerS Date: Sun, 16 Mar 2025 20:00:25 -0600 Subject: [PATCH 5/7] Changed gradle version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index ff7b120e..06d04e4c 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ plugins { // gretty is a gradle plugin to make it easy to run a server and hotswap code at runtime. // https://plugins.gradle.org/plugin/org.gretty - id 'org.gretty' version '3.0.4' + id 'org.gretty' version '3.1.5' // provides access to a database versioning tool. id "org.flywaydb.flyway" version "6.0.8" From 2f10fd58a99324b11bdcb97586ddc60f4d7b5a9a Mon Sep 17 00:00:00 2001 From: jaybarc <144380640+jaybarc@users.noreply.github.com> Date: Mon, 17 Mar 2025 18:30:08 +0000 Subject: [PATCH 6/7] added full docker file to containerize app builds and deployment on 8080 --- Dockerfile | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 77568444..df1dd66d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -# using slim cuz its more lightweight than the normal jdk -FROM openjdk:17-jdk-slim +# use gradle 7.6, jdk-11 like video on d2l +FROM gradle:7.6-jdk11 AS builder +WORKDIR /home/gradle/project -# default directory going to be desktop_app -WORKDIR /desktop_app +COPY . . RUN apt-get update @@ -13,4 +13,22 @@ RUN apt-get install -y curl RUN apt-get install -y unzip # cleaning up the cache to make the imahe as small as possible -RUN apt-get clean \ No newline at end of file +RUN apt-get clean + +# clean and build project, avoid the daemon +RUN gradle clean build --no-daemon --refresh-dependencies + +# tomcat base img, jdk 11 use again +FROM tomcat:9-jre11 + +# working dir inside tomcat container +WORKDIR /usr/local/tomcat/webapps + +# take out default ROOT app if there is any +RUN rm -rf ROOT + +# copy war file that was built from initial stage to tomcat webapps directory, renamed to ROOT +COPY --from=builder /home/gradle/project/build/libs/*.war ./ROOT.war + +# Localhost 8080 here +EXPOSE 8080 \ No newline at end of file From 9025bfc1deedb203be791e7a3f503c73ef25e78f Mon Sep 17 00:00:00 2001 From: JaisumerS Date: Mon, 17 Mar 2025 20:50:03 -0600 Subject: [PATCH 7/7] Added visible comments for clarity, also fixed performance issue in dockerfile --- Dockerfile | 10 +++++----- build.gradle | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index df1dd66d..630bf4b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,15 +2,15 @@ FROM gradle:7.6-jdk11 AS builder WORKDIR /home/gradle/project +# Copy all project files into the container COPY . . +# Update the package lists to fetch the latest versions of available packages RUN apt-get update # installing necessary dependencies -RUN apt-get install -y python3 -RUN apt-get install -y python3-pip -RUN apt-get install -y curl -RUN apt-get install -y unzip +RUN apt-get install -y python3 python3-pip curl unzip +#cleaned up so more image layers arent present # cleaning up the cache to make the imahe as small as possible RUN apt-get clean @@ -30,5 +30,5 @@ RUN rm -rf ROOT # copy war file that was built from initial stage to tomcat webapps directory, renamed to ROOT COPY --from=builder /home/gradle/project/build/libs/*.war ./ROOT.war -# Localhost 8080 here +# Expose port 8080 so the application can be accessed from outside the container EXPOSE 8080 \ No newline at end of file diff --git a/build.gradle b/build.gradle index 06d04e4c..825bba95 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,8 @@ plugins { // gretty is a gradle plugin to make it easy to run a server and hotswap code at runtime. // https://plugins.gradle.org/plugin/org.gretty - id 'org.gretty' version '3.1.5' + id 'org.gretty' version "3.1.5" + //had to update gradle version as previous version was outdated // provides access to a database versioning tool. id "org.flywaydb.flyway" version "6.0.8"