Skip to content

Added a bin folder and changed the maven clean command #5

Added a bin folder and changed the maven clean command

Added a bin folder and changed the maven clean command #5

Workflow file for this run

# This workflow will build docker image and push it to DockerHub,
# After that, This wrkflow build and push a new container image to Amazon ECR,
# and then will deploy a new task definition to Amazon ECS, when there is a push to the "main" branch.
name: CI/CD Pipeline # Name of the CI/CD Pipeline
on:
push:
branches: [ "main" ] # Trigger on push events to the main branch
pull_request:
branches: [ "main" ] # Trigger on pull requests to the main branch
jobs:
build-and-deploy:
runs-on: ubuntu-latest # Runs on the latest version of Ubuntu | Default operating system environment for workflows unless explicitly specified.
steps:
- name: Checkout code # Step to checkout the code from the repository | Fetch the source code repository into the runner machine where our workflow is executing.
uses: actions/checkout@v4

Check failure on line 20 in .github/workflows/ci-cd.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci-cd.yml

Invalid workflow file

You have an error in your yaml syntax on line 20
- name: Set up JDK 17 # Step to set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'oracle'
# Build the Spring Boot app using Maven
- name: Build Spring Boot App with Maven
run: mvn -f demo/pom.xml clean install
- name: build and push the docker image to dockerhub
run: |
# 1. Login to DockerHub
# 2. Build the Docker image
# 3. Push the Docker image to DockerHub
# 4. Run the Docker image
# 5. Fetch logs from the running container
# 6. Stop the container after the test
# 7. Remove the container after the test
# 8. Cleanup dangling images (optional)
docker login -u gowthamdineshrajkumar -p gowthamdineshrajkumar
docker build -f demo/Dockerfile -t gowthamdineshrajkumar/demospringboot .
docker push gowthamdineshrajkumar/demospringboot:latest
docker run -d --name demospringboot-container -p 8080:8080 gowthamdineshrajkumar/demospringboot:latest
docker logs --tail 50 demospringboot-container
docker stop demospringboot-container
docker rm demospringboot-container
docker image prune -f