Skip to content

Commit 6bec4a9

Browse files
Added a ci build file.
1 parent f6e253f commit 6bec4a9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

demo/.github/workflows/ci-cd.yml renamed to .github/workflows/ci-cd.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,23 @@ jobs:
2626
cache: maven
2727

2828
- name: Build with Maven # Step to build the project with Maven
29-
run: mvn clean install
29+
run: mvn -f demo/pom.xml clean install
3030

3131
- name: build and push the docker image to dockerhub
3232
run: |
3333
# 1. Login to DockerHub
3434
# 2. Build the Docker image
3535
# 3. Push the Docker image to DockerHub
36+
# 4. Run the Docker image
37+
# 5. Fetch logs from the running container
38+
# 6. Stop the container after the test
39+
# 7. Remove the container after the test
40+
# 8. Cleanup dangling images (optional)
3641
docker login -u gowthamdineshrajkumar -p gowthamdineshrajkumar
37-
docker build -t gowthamdineshrajkumar/demospringboot .
38-
docker push gowthamdineshrajkumar/demospringboot:latest
42+
docker build -f demo/Dockerfile -t gowthamdineshrajkumar/demospringboot .
43+
docker push gowthamdineshrajkumar/demospringboot:latest
44+
docker run -d --name demospringboot-container -p 8080:8080 gowthamdineshrajkumar/demospringboot:latest
45+
docker logs --tail 50 demospringboot-container
46+
docker stop demospringboot-container
47+
docker rm demospringboot-container
48+
docker image prune -f

0 commit comments

Comments
 (0)