Skip to content

docs: README.md

docs: README.md #73

Workflow file for this run

name: Main Workflow
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 저장소 Checkout
uses: actions/checkout@v3
# Java 17 세팅
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
## create .yml
- name: make application.yml
run: |
mkdir -p src/main/resources
touch ./src/main/resources/application.yml
echo "${{ secrets.APPLICATION }}" >> ./src/main/resources/application.yml
- name: 스프링부트 애플리케이션 빌드
run: ./gradlew bootJar
- name: 도커 이미지 빌드
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/bookdiary --platform linux/amd64 .
- name: 도커 로그인
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: 도커 이미지 push
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/bookdiary
- name: 배포
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_SERVER_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
docker stop $(docker ps -a -q)
docker rm -f $(docker ps -qa)
docker pull ${{ secrets.DOCKER_USERNAME }}/bookdiary
docker run -d -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/bookdiary
docker image prune -f