diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index e4933a6..4837911 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -91,7 +91,7 @@ jobs: - name: Build, Test, and Analyze with Maven run: | mvn clean verify sonar:sonar \ - -Dsonar.projectKey=ShopSmartSG_central-repo-service \ + -Dsonar.projectKey=ShopSmartSG_shopsmartsg-backend \ -Dsonar.organization=shopsmartsg \ -Dsonar.host.url=https://sonarcloud.io \ -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ @@ -106,8 +106,8 @@ jobs: - name: Build Docker image run: | - docker build -t shopsmartsg/central-repo-service . - docker tag shopsmartsg/central-repo-service:latest ${{ secrets.ECR_REPO_URI }}:latest + docker build -t shopsmartsg/central-hub . + docker tag shopsmartsg/central-hub:latest ${{ secrets.ECR_REPO_URI }}:latest - name: Push Docker image to ECR run: | diff --git a/.github/workflows/zap-scan.yml b/.github/workflows/zap-scan.yml index 7181284..70558d5 100644 --- a/.github/workflows/zap-scan.yml +++ b/.github/workflows/zap-scan.yml @@ -27,25 +27,25 @@ jobs: - name: Create Docker Network run: docker network create zap-network - # Step 2: Build the Docker image for the central-repo-service + # Step 2: Build the Docker image for the central-hub - name: Build Docker Image uses: docker/build-push-action@v4 with: context: . file: ./Dockerfile push: false - tags: central-repo-service:latest + tags: central-hub:latest # Step 3: Run the Docker container for the application in the zap-network - name: Run Docker Container - run: docker run -d --name central-repo-service --network zap-network -p 8084:8084 central-repo-service:latest + run: docker run -d --name central-hub --network zap-network -p 8082:8082 central-hub:latest # Step 4: Wait for the application to start and be available - name: Wait for Application to Start run: | echo "Waiting for the application to start..." for i in {1..10}; do - if curl -s http://localhost:8084 >/dev/null; then + if curl -s http://localhost:8082 >/dev/null; then echo "Application is up!" break fi @@ -57,9 +57,9 @@ jobs: - name: ZAP Full Scan uses: zaproxy/action-full-scan@v0.11.0 with: - target: 'http://central-repo-service:8084' # Target by container name in the zap-network + target: 'http://central-hub:8082' # Target by container name in the zap-network token: ${{ secrets.GITHUB_TOKEN }} - cmd_options: '-t http://central-repo-service:8084 -r zap_report.html' + cmd_options: '-t http://central-hub:8082 -r zap_report.html' # Step 6: Upload the ZAP report as an artifact - name: Upload ZAP Report diff --git a/Dockerfile b/Dockerfile index 437c7a7..225f285 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,22 +10,22 @@ RUN mvn clean package FROM openjdk:21-jdk-slim # Create the log directory and set proper permissions -RUN mkdir -p /var/log/central-repo-service && \ - chmod -R 777 /var/log/central-repo-service # Ensure the app can write to the log directory +RUN mkdir -p /var/log/central-hub && \ + chmod -R 777 /var/log/central-hub # Ensure the app can write to the log directory # Copy the project’s jar file into the container at /app -COPY --from=build /app/target/central-repo-service.jar central-repo-app.jar +COPY --from=build /app/target/central-hub.jar central-repo-app.jar -# Make port 8084 available to the world outside this container -EXPOSE 8084 +# Make port 8082 available to the world outside this container +EXPOSE 8082 # Run the jar file ENTRYPOINT ["java", "-jar", "central-repo-app.jar"] # to build image after building jar post any changes -# docker build -t central-repo-service:latest . +# docker build -t central-hub:latest . # docker-compose up --build -# docker push simranarora264/central-repo-service:latest +# docker push simranarora264/central-hub:latest # docker file and docker-compose port should be same # docker-compose down : shutdown the container # till we shutdown the postgres image , db remains intact diff --git a/pom.xml b/pom.xml index 6e15f1c..06d3d70 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ - central-repo-service + central-hub org.springframework.boot