diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml new file mode 100644 index 0000000..dce33de --- /dev/null +++ b/.github/workflows/github-actions.yml @@ -0,0 +1,43 @@ +name: issue-tracking-system CI/CD + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + + - name: Set up environment variables + run: | + echo "DB_URL=${{ secrets.DB_URL }}" >> $GITHUB_ENV + echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> $GITHUB_ENV + echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> $GITHUB_ENV + + - name: Build with Gradle + run: ./gradlew build + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build Docker image + run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracking-system:latest . + + - name: Push Docker image + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracking-system:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9542819 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM openjdk:17-jdk + +ARG JAR_FILE=build/libs/*.jar + +COPY ${JAR_FILE} app.jar + +ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file