-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CHORE : ci & cd 관련 workflows yml 변경 추가 (#161)
- Loading branch information
1 parent
52e3f39
commit 52efb79
Showing
1 changed file
with
8 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: CI/CD Automation using github actions and Docker | ||
name: 🎇 Deployer | ||
|
||
on: | ||
push: | ||
|
@@ -10,7 +10,6 @@ permissions: | |
contents: read | ||
|
||
jobs: | ||
## CI | ||
build: | ||
name: CI | ||
runs-on: ubuntu-latest | ||
|
@@ -24,7 +23,6 @@ jobs: | |
java-version: '11' | ||
distribution: 'temurin' | ||
|
||
# Gradle 캐싱 빌드 시간 향상 | ||
- name: Gradle Caching | ||
uses: actions/cache@v3 | ||
with: | ||
|
@@ -41,39 +39,38 @@ jobs: | |
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
|
||
# Dockerhub Login | ||
|
||
- name: Login to Dockerhub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{secrets.DOCKER_USERNAME}} | ||
password: ${{secrets.DOCKER_PASSWORD}} | ||
|
||
# Docker buildx set up | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Docker build & push | ||
|
||
- name: Docker build & push to DockerHub | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/better-iter:latest | ||
## CD | ||
|
||
deploy: | ||
name: CD | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
# Deploy to prod | ||
- name: Connect to WAS & Execute Application | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST_IP }} # EC2 퍼블릭 IPv4 DNS | ||
username: ${{ secrets.USERNAME }} # ubuntu | ||
host: ${{ secrets.HOST_IP }} | ||
username: ${{ secrets.USERNAME }} | ||
port: 22 | ||
key: ${{ secrets.PRIVATE_KEY }} # pem | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
script: | | ||
docker -v | ||
docker ps | ||
|