Feat/#74 logging 설정 변경 (#75) #50
Workflow file for this run
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: Yonsei-Golf DEV CI | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
WORKING_DIRECTORY: ./ | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Set application properties | |
run: | | |
touch src/main/resources/application.properties | |
echo "${{ secrets.APPLICATION_PROPERTIES }}" > src/main/resources/application.properties | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Build with Gradle | |
run: | | |
chmod +x gradlew | |
./gradlew clean build | |
env: | |
WORKING_DIRECTORY: ${{ env.WORKING_DIRECTORY }} | |
- name: docker build and push | |
run: | | |
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.DOCKER_USERNAME }} | |
docker build --platform linux/amd64 -t hifit-ecr . | |
docker tag hifit-ecr:latest ${{ secrets.DOCKER_USERNAME }}/hifit-ecr:latest | |
docker push ${{ secrets.DOCKER_USERNAME }}/hifit-ecr:latest | |
- name: executing remote ssh commands using password | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ubuntu | |
key: ${{ secrets.KEY }} | |
script: | | |
sudo docker rm -f hifit-ecr | |
sudo aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | sudo docker login --username AWS --password-stdin ${{ secrets.DOCKER_USERNAME }} | |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/hifit-ecr:latest | |
sudo docker run -d --name hifit-ecr -p 8080:8080 -v /home/ubuntu/be-log:/var/log ${{ secrets.DOCKER_USERNAME }}/hifit-ecr:latest | |
sudo docker image prune -a -f |