diff --git a/.github/workflows/commit-dev.yml b/.github/workflows/commit-dev.yml new file mode 100644 index 0000000..3fec592 --- /dev/null +++ b/.github/workflows/commit-dev.yml @@ -0,0 +1,55 @@ +name: RESO Web API Reference Server Development Enviroment CI/CD + +on: + push: + branches: + - "develop" + - "feature/*-development" + - "release/*-development" + - "hotfix/*-development" + - "support/*-development" + +jobs: + build-and-deploy: + runs-on: ubuntu-20.04 + env: + ENVIRONMENT: dev + DOCKER_BUILDKIT: 1 + steps: + + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + + - name: Run ENV setup script + run: | + chmod +x ./docker/scripts/setup_build_env.sh + ./docker/scripts/setup_build_env.sh + + - name: Run build script + run: | + chmod +x ./docker/scripts/build.sh + ./docker/scripts/build.sh + + - name: Run docker-compose to make the images + run: docker-compose build + + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Push to Dockerhub + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: michaelpede/reso-web-api-reference-server_odata-manager-app:latest +# We don't really need the SQL server "build" as it's a default Docker build +# - name: Run docker build for the WEB API Server Database +# run: docker save --output database-server.tar mysql/mysql-server diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml deleted file mode 100644 index 5b90487..0000000 --- a/.github/workflows/gradle-publish.yml +++ /dev/null @@ -1,41 +0,0 @@ -# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle - -name: Gradle Package - -on: - push: - branches: - - "develop" # not a branch that currently exists. No need to do this atm. - -jobs: - build: - - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Build with Gradle - run: gradle build - - - name: Create WAR - run: gradle war - - # The USERNAME and TOKEN need to correspond to the credentials environment variables used in - # the publishing section of your build.gradle - - name: Publish to GitHub Packages - run: gradle publish - env: - USERNAME: ${{ github.actor }} - TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index d877905..80a286a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV JPDA_ADDRESS="*:8000" ENV JPDA_TRANSPORT="dt_socket" #Not needed while volume mapped for development -#COPY ./target/RESOservice-1.0.war /usr/local/tomcat/webapps/ -#COPY ./target/RESODataDictionary-1.7.metadata-report.json /usr/local/tomcat/webapps/ +COPY ./target/RESOservice-1.0.war /usr/local/tomcat/webapps/ +COPY ./target/RESODataDictionary-1.7.metadata-report.json /usr/local/tomcat/webapps/ CMD ["catalina.sh", "jpda", "run"] diff --git a/docker/scripts/build.sh b/docker/scripts/build.sh index 7dbf0b8..2508763 100644 --- a/docker/scripts/build.sh +++ b/docker/scripts/build.sh @@ -38,16 +38,23 @@ fi #unzip -d /opt/gradle /tmp/gradle-${VERSION}-bin.zip #ln -s /opt/gradle/gradle-${VERSION} /opt/gradle/latest +if gradle build +then + cp build/libs/RESOservice-1.0.war ./target/ + cp RESODataDictionary-1.7.metadata-report.json ./target/ +else + #/opt/gradle/latest/bin/gradle build #mkdir target #cp build/libs/RESOservice-1.0.war ./target/ #cp RESODataDictionary-1.7.metadata-report.json ./target/ -if ! mvn compile -then - echo "Maven could not be found." - exit -else - mvn package - cp RESODataDictionary-1.7.metadata-report.json ./target/ -fi + if ! mvn compile + then + echo "Maven could not be found." + exit + else + mvn package + cp RESODataDictionary-1.7.metadata-report.json ./target/ + fi +fi \ No newline at end of file diff --git a/docker/scripts/setup_build_env.sh b/docker/scripts/setup_build_env.sh new file mode 100644 index 0000000..888979b --- /dev/null +++ b/docker/scripts/setup_build_env.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# This will run commands to setup your build server / Ubuntu 20.10 with the needed prerequisites. + +DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y wget pip maven docker-compose \ No newline at end of file