Skip to content

πŸ“ docs: ν…œν”Œλ¦Ώ μˆ˜μ • 및 README.md 에 컀밋 μ»¨λ²€μ…˜ μΆ”κ°€ (#61) #7

πŸ“ docs: ν…œν”Œλ¦Ώ μˆ˜μ • 및 README.md 에 컀밋 μ»¨λ²€μ…˜ μΆ”κ°€ (#61)

πŸ“ docs: ν…œν”Œλ¦Ώ μˆ˜μ • 및 README.md 에 컀밋 μ»¨λ²€μ…˜ μΆ”κ°€ (#61) #7

Workflow file for this run

name: Java CD with Gradle
on:
push:
branches: [ "develop" ]
jobs:
cd:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# DockerHub Login (2)
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# AWS EC2 Server Connect & Docker command execution
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }} # EC2 instance public DNS
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }} # pem key
script: |
sudo docker stop sponus-docker
sudo docker rm sponus-docker
sudo docker rmi ${{ secrets.DOCKER_USERNAME }}/sponus-docker
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/sponus-docker
sudo docker stop my-redis
sudo docker rm my-redis
sudo docker rmi redis
sudo docker pull redis
sudo docker network create my-network
sudo docker run --name my-redis --network my-network -d redis
sudo docker run -e SPRING_PROFILES_ACTIVE=prod -it -d -p 8080:8080 --name sponus-docker -e TZ=Asia/Seoul --network my-network ${{ secrets.DOCKER_USERNAME }}/sponus-docker