Merge pull request #98 from prgrms-web-devcourse-final-project/revert… #48
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: Deploy to AWS EC2 using Docker | |
# | |
#on: | |
# push: | |
# branches: | |
# - main | |
# | |
#jobs: | |
# build-and-push-docker: | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# - name: Checkout source code | |
# uses: actions/checkout@v3 | |
# | |
# # 필요한 환경 변수 설정 | |
# - name: Set environment variables | |
# run: echo "LOG_SERVER_IP=${{ secrets.LOG_SERVER_IP }}" >> $GITHUB_ENV | |
# | |
# # application.yml 생성 | |
# - name: Create application.yml | |
# run: | | |
# echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.yml | |
# cat ./src/main/resources/application.yml # 확인용 | |
# | |
# # logback-spring.xml 생성 | |
# - name: Create logback-spring.xml | |
# run: | | |
# echo "${{ secrets.LOG_BACK }}" > ./src/main/resources/logback-spring.xml | |
# cat ./src/main/resources/logback-spring.xml # 확인용 | |
# | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v3 | |
# with: | |
# java-version: '17' | |
# distribution: 'temurin' | |
# | |
# - name: Gradle 권한 설정 | |
# run: sudo chmod +x gradlew | |
# | |
# - name: Build with Gradle | |
# run: ./gradlew build --stacktrace --info | |
# | |
# - name: application.yml 파일 셋팅 | |
# run: | | |
# echo "${{ secrets.APPLICATION }}" | base64 --decode > ./src/main/resources/application.yml | |
# | |
# - name: 디버그 application.yml 확인 | |
# run: cat ./src/main/resources/application.yaml | |
# | |
# - name: Log xml 환경변수 서렂 | |
# run: echo "LOG_SERVER_IP=${{ secrets.LOG_SERVER_IP }}" >> $GITHUB_ENV | |
# | |
# - name: logback-spring.xml 디코더 밎 파일 작성 | |
# run: | | |
# echo "${{ secrets.LOG_BACK }}" | base64 --decode > ./src/main/resources/logback-spring.xml | |
# | |
# - name: 디버그 logback-spring.xml 확인 | |
# run: cat ./src/main/resources/logback-spring.xml | |
# | |
# - name: gradle 권한 설정 | |
# run: sudo chmod +x gradlew | |
# | |
# - name: Build with Gradle (without tests) | |
# run: ./gradlew build -x test --stacktrace --info | |
# | |
# - name: Build the Docker image | |
# run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_IMAGE_NAME }}:latest | |
# | |
# - name: Login to Docker Hub | |
# run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
# | |
# - name: Push the Docker image | |
# run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}:latest | |
# | |
# | |
## | |
## deploy-to-ec2: | |
## | |
## needs: build-and-push-docker | |
## runs-on: ubuntu-latest | |
## | |
## steps: | |
## - name: Deploy to EC2 | |
## uses: appleboy/ssh-action@master | |
## with: | |
## host: ${{ env.EC2_HOST }} | |
## username: ${{ env.EC2_SSH_USER }} | |
## key: ${{ env.PRIVATE_KEY }} | |
## script: | | |
## CONTAINER_ID=$(sudo docker ps -q --filter "publish=80-8080") | |
## | |
## if [ ! -z "$CONTAINER_ID" ]; then | |
## sudo docker stop $CONTAINER_ID | |
## sudo docker rm $CONTAINER_ID | |
## fi | |
## | |
## sudo docker pull ${{ env.DOCKER_HUB }} | |
## sudo docker run --name ${{ env.CONTAINER_NAME }} -d -p 80:8080 -e TZ=Asia/Seoul ${{ env.DOCKER_HUB }} |