fix: servlet context path #27
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: (1) Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: (2) Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
# Gradle Build (test ์ ์ธ) | |
- name: (3) Build with Gradle | |
run: ./gradlew clean build --exclude-task test | |
# - name: CHECK PATH | |
# run: pwd | |
# - name: CHECK LS | |
# run: ls | |
# Docker ์ด๋ฏธ์ง ๋น๋ | |
- name: (4) Docker Image Build | |
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/vvue-be-img . | |
# DockerHub ๋ก๊ทธ์ธ | |
- name: (5) DockerHub Login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
# DockerHub Push | |
- name: (6) DockerHub Push | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/vvue-be-img | |
ec2: | |
name: ec2 | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: (7) Application Run | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_KEY }} | |
port: ${{ secrets.EC2_PORT }} | |
script: | | |
if sudo docker ps -a | grep vvue-be-container; then sudo docker rm -f vvue-be-container; fi | |
if sudo docker images | grep ${{ secrets.DOCKERHUB_USERNAME }}/vvue-be-img; then sudo docker rmi -f ${{ secrets.DOCKERHUB_USERNAME }}/vvue-be-img; fi | |
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/vvue-be-img | |
sudo docker-compose -f ${{secrets.DOCKER_COMPOSE_FILE_PATH}} down | |
sudo docker-compose -f ${{secrets.DOCKER_COMPOSE_FILE_PATH}} up -d |