diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..3f6913bf --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,43 @@ +name: vprofile actions +on: workflow_dispatch +env: + AWS_REGION: us-east-2 + ECR_REPOSITORY: vprofileapp + EKS_CLUSTER: vprofile-eks + +jobs: + Testing: + runs-on: ubuntu-latest + steps: + - name: Code checkout + uses: actions/checkout@v4 + + - name: Maven test + run: mvn test + + - name: Checkstyle + run: mvn checkstyle:checkstyle + + # Setup java 11 to be default (sonar-scanner requirement as of 5.x) + - name: Set Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: '11' + + - name: Build & Upload image to ECR + uses: appleboy/docker-ecr-action@master + with: + access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} + secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + registry: ${{ secrets.REGISTRY }} + repo: ${{ env.ECR_REPOSITORY }} + region: ${{ env.AWS_REGION }} + tags: latest,${{ github.run_number }} + daemon_off: false + dockerfile: ./Dockerfile + context: ./ + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 267c0571..ca8b70b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,3 +11,5 @@ COPY --from=BUILD_IMAGE vprofile-project/target/vprofile-v2.war /usr/local/tomca EXPOSE 8080 CMD ["catalina.sh", "run"] + +