httprefactor: final 키워드 삽입 #87
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: cd-dev | |
on: | |
push: | |
branches: [ "dev" ] | |
jobs: | |
deploy-to-ec2: | |
environment: dev | |
runs-on: ubuntu-latest | |
steps: | |
- name: Github Repository Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.ACCESS_TOKEN }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
- name: Docker Hub Login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Docker Image Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ secrets.DOCKER_HUB_REPOSITORY }} | |
- name: Copy Deployment Files to EC2 | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.EC2_INSTANCE_HOST }} | |
username: ${{ secrets.EC2_INSTANCE_USERNAME }} | |
key: ${{ secrets.EC2_INSTANCE_PRIVATE_KEY }} | |
source: './deploy/dev/*' | |
target: '~/pickple/deploy' | |
strip_components: 1 | |
- name: Docker Container Run | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_INSTANCE_HOST }} | |
username: ${{ secrets.EC2_INSTANCE_USERNAME }} | |
key: ${{ secrets.EC2_INSTANCE_PRIVATE_KEY }} | |
script: | | |
docker pull ${{ secrets.DOCKER_HUB_REPOSITORY }} | |
cd ~/pickple/deploy/dev | |
docker-compose -p pickple-dev down | |
docker-compose -p pickple-dev up -d | |
docker image prune -f |