Skip to content

Merge pull request #177 from Let-s-intern/dev #125

Merge pull request #177 from Let-s-intern/dev

Merge pull request #177 from Let-s-intern/dev #125

Workflow file for this run

#name: Deploy to EC2
#
#on:
# push:
# branches:
# - dev
# pull_request:
# branches:
# - dev
#
#permissions:
# contents: read
#
#jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# # 기본 체크아웃
# - name: Checkout
# uses: actions/checkout@v3
#
# # JDK version 설정
# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
#
# # Gradlew Permission
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
#
# # Gradle Caching
# - name: Gradle Caching
# uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
#
# ## Make application-secret.yml
# - name: Make application-secret.yml
# run: |
# touch ./src/main/resources/application-dev.yml
# echo "${{ secrets.APPLICATION_SECRET_DEV }}" > ./src/main/resources/application-dev.yml
# env:
# PROPERTIES_DEV: ${{ secrets.APPLICATION_SECRET_DEV }}
#
# # Build with Gradle
# - name: Build with Gradle
# run: ./gradlew build -x test
#
# - name: Docker meta
# id: docker_meta
# uses: crazy-max/ghaction-docker-meta@v1
# with:
# images: letsintern/letsintern-server-dev
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
#
# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: Docker build & push
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./Dockerfile
# platforms: linux/amd64
# push: true
# tags: ${{ secrets.DOCKER_USERNAME }}/letsintern-server-dev
#
# - name: create remote directory
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.EC2_HOST_DEV }}
# username: ubuntu
# key: ${{ secrets.EC2_KEY_DEV }}
# script: mkdir -p ~/srv/ubuntu/letsintern-server-dev
#
# - name: copy source via ssh key
# uses: burnett01/[email protected]
# with:
# switches: -avzr --delete
# remote_path: ~/srv/ubuntu/
# remote_host: ${{ secrets.EC2_HOST_DEV }}
# remote_user: ubuntu
# remote_key: ${{ secrets.EC2_KEY_DEV }}
#
# - name: executing remote ssh commands using password
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.EC2_HOST_DEV }}
# username: ubuntu
# key: ${{ secrets.EC2_KEY_DEV }}
# script: |
# sudo docker rm -f $(docker ps -qa)
# sudo docker pull ${{ secrets.DOCKER_USERNAME }}/letsintern-server-dev
# sudo docker run -d -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/letsintern-server-dev
# sudo docker image prune -f