Skip to content

Merge :: 구글 연동 해제 & 리프레시 에러 해결 (#344) #34

Merge :: 구글 연동 해제 & 리프레시 에러 해결 (#344)

Merge :: 구글 연동 해제 & 리프레시 에러 해결 (#344) #34

Workflow file for this run

name: CI/CD using GitHub Actions & Docker
on:
push:
branches: ["main"]
permissions:
contents: write
jobs:
CI-CD:
runs-on: ubuntu-latest
steps:
- name: Set up Temurin JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Load gradle cache
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: Checkout project
uses: actions/checkout@v3
- name: Create application yml files
run: |
for profile in local prod; do
echo "${{ secrets.APPLICATION_YML }}" | base64 -d > ./src/main/resources/application-$profile.yml
done
- name: Create firebase config
run: echo "${{ secrets.FIREBASE }}" | base64 -d > ./src/main/resources/"${{ secrets.FIREBASE_FILE_NAME }}"
- name: Build with Gradle
run: ./gradlew clean build
- name: Build docker image & push
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker buildx build --platform linux/arm64/v8 -t "${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROJECT}}" --push .
- name: Deploy docker container
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_PROD }}
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROJECT}} || true
if docker ps -a --format '{{.Names}}' | grep -q ${{ secrets.DOCKER_PROJECT}}; then
docker stop ${{ secrets.DOCKER_PROJECT}} || true
docker rm ${{ secrets.DOCKER_PROJECT}} || true
fi
if docker images | grep -q "${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROJECT}}"; then
docker rmi -f $(docker images -q "${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROJECT}}") || true
fi
if docker volume ls -q --filter "name=${{ secrets.DOCKER_PROJECT}}" | grep -q .; then
docker volume rm $(docker volume ls -q --filter "name=${{ secrets.DOCKER_PROJECT}}") || true
fi
docker run -d --name ${{ secrets.DOCKER_PROJECT}} -p 80:8080 -p 9090:9090 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROJECT}}