chore: Position, Address에 대해 common에서 별도의 디렉토리로 분리 #9
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: Container Registry Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} | |
password: ${{ secrets.ACCESS_TOKEN }} | |
- name: Docker Image Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ secrets.CONTAINER_REGISTRY_IMAGE_TAG }} | |
- 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.CONTAINER_REGISTRY_IMAGE_TAG }} | |
cd ~/pickple/deploy/dev | |
docker-compose -p pickple-dev down | |
docker-compose -p pickple-dev up -d | |
docker image prune -f |