WebSocket cors 오류 해결 #20
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
name: Java CI/CD with Gradle | |
on: | |
push: | |
branches: [ "develop" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Create application.yml | |
run: | | |
mkdir -p src/main/resources | |
echo "${{ secrets.APPLICATION_YML }}" > src/main/resources/application.yml | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Spring Boot Build | |
run: ./gradlew clean build -x test | |
- name: Docker Image Build | |
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGENAME }} . | |
- name: Docker Hub Login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker Hub push | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGENAME }} | |
- name: AWS EC2 Connection | |
uses: appleboy/ssh-action@v0.1.6 | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
password: ${{ secrets.EC2_PASSWORD }} | |
port: ${{ secrets.EC2_SSH_PORT }} | |
timeout: 60s | |
script: | | |
sudo docker stop ${{ secrets.DOCKERHUB_IMAGENAME }} | |
sudo docker rm ${{ secrets.DOCKERHUB_IMAGENAME }} | |
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGENAME }} | |
sudo docker run -it -d -p 8080:8080 --name ${{ secrets.DOCKERHUB_IMAGENAME }} -e TZ=Asia/Seoul ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGENAME }} |