fix: 사용자 profileImageUrl Query Response Nullable #112
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: Backend Dev CD | |
on: | |
push: | |
branches: | |
- dev | |
env: | |
SECRET_TOKEN: ${{ secrets.SECRET_TOKEN }} | |
KODDY_DEV_SERVER_HOST: ${{ secrets.KODDY_DEV_SERVER_HOST }} | |
KODDY_DEV_SERVER_PORT: ${{ secrets.KODDY_DEV_SERVER_PORT }} | |
KODDY_DEV_SERVER_USERNAME: ${{ secrets.KODDY_DEV_SERVER_USERNAME }} | |
KODDY_DEV_SERVER_KEY: ${{ secrets.KODDY_DEV_SERVER_KEY }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} | |
DOCKER_IMAGE_NAME: sjiwon/koddy-be | |
DOCKER_IMAGE_TAG: ${{ github.run_number }} | |
jobs: | |
build: | |
name: Backend Dev Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Repository를 가져온다 | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ env.SECRET_TOKEN }} | |
submodules: true | |
- name: JDK 17을 설정한다 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Gradle 정보를 캐싱한다 | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Timezone을 Asia/Seoul로 설정한다 | |
uses: zcong1993/setup-timezone@master | |
with: | |
timezone: Asia/Seoul | |
- name: Gradle 명령 실행을 위한 권한을 부여한다 | |
run: chmod +x gradlew | |
- name: Gradle build를 수행한다 | |
run: ./gradlew bootJar | |
- name: Docker Hub에 로그인을 진행한다 | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKER_USERNAME }} | |
password: ${{ env.DOCKER_PASSWORD }} | |
- name: Docker Hub에 Docker Image를 Push한다 | |
run: | | |
docker build -t ${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }} -f Dockerfile.dev ./ | |
docker images | |
docker push ${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }} | |
- name: EC2 서버에 접속 후 Docker Image를 Pull & Run한다 | |
uses: appleboy/ssh-action@v1.0.2 | |
with: | |
host: ${{ env.KODDY_DEV_SERVER_HOST }} | |
username: ${{ env.KODDY_DEV_SERVER_USERNAME }} | |
key: ${{ env.KODDY_DEV_SERVER_KEY }} | |
port: ${{ env.KODDY_DEV_SERVER_PORT }} | |
script: | | |
docker pull ${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }} | |
docker rm -f $(sudo docker container ls -aq -f name=application) | |
docker run -d \ | |
--name application \ | |
--network koddy-network \ | |
-p 8080:8080 \ | |
-v /home/ec2-user/koddy/logs:/app/logs \ | |
${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }} | |
docker image prune -f |