Build to DockerHub

This commit is contained in:
michaelpede 2021-11-02 09:58:05 -07:00
parent 2171cd60a7
commit 953baf5a64
5 changed files with 77 additions and 51 deletions

55
.github/workflows/commit-dev.yml vendored Normal file
View File

@ -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

View File

@ -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 }}

View File

@ -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"]

View File

@ -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

View File

@ -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