From c146b187cb2edc8c68fb66fc44d951c5b805fb28 Mon Sep 17 00:00:00 2001 From: Rahul Kausale Date: Mon, 2 Dec 2024 16:39:04 +0000 Subject: [PATCH] docker file added. action builds and pushes the image --- .github/workflows/assignment1.yml | 8 ++++++++ Dockerfile | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 Dockerfile diff --git a/.github/workflows/assignment1.yml b/.github/workflows/assignment1.yml index 4740ddbc..c0c51fa6 100644 --- a/.github/workflows/assignment1.yml +++ b/.github/workflows/assignment1.yml @@ -29,7 +29,15 @@ jobs: cache: maven - name: Build with Maven run: mvn -B package --file pom.xml + + - name: Build docker image + run: docker build -t rahulkausale/hello-world:latest . + - name: Login to docker + run: docker login -u ${{ secrets.DUSERNAME }} -p ${{ secrets.DPASSWORD }} + + - name: Push the image to docker registry + run: docker push rahulkausale/hello-world:latest # # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive # - name: Update dependency graph # uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e0d37dd3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM maven:3.8.5-openjdk-17 +EXPOSE 8080 +ADD target/spring-boot-2-hello-world-1.0.2-SNAPSHOT.jar app.jar + +ENTRYPOINT exec java -jar -Djava.net.preferIPv4Stack=true app.jar \ No newline at end of file