-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from H-Hive/EUNCHAEv1006-patch-1
Create gradle.yml
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: hhive | ||
|
||
on: | ||
pull_request: | ||
branches: [ dev ] | ||
types: [closed] | ||
|
||
jobs: | ||
build-docker-image: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
|
||
- name: web docker build and push | ||
run: | | ||
sudo docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
sudo docker build -f Dockerfile -t ${{ secrets.DOCKERHUB_USERNAME }}/hhive . | ||
sudo docker push ${{ secrets.DOCKERHUB_USERNAME }}/hhive | ||
- name: Deploy Front to prod | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.AWS_HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.AWS_SSH_KEY }} | ||
port: 22 | ||
script: | | ||
if docker ps -a --format ‘{{.ID}}’ | grep -q .; then | ||
sudo docker rm -f $(docker ps -qa) | ||
else | ||
echo “No Docker containers to remove.” | ||
fi | ||
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/hhive | ||
sudo docker run --name hhive -d ${{ secrets.DOCKERHUB_USERNAME }}/hhive | ||
sudo docker run --name redis-server -d -p 6379:6379 redis | ||
docker image prune -f |