-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from itsme-shawn/itsme-shawn
[18기_최현수] Github Action을 이용한 CI/CD 배포 미션 제출합니다.
- Loading branch information
Showing
16 changed files
with
307 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Deploy Development Server | ||
|
||
## develop 브랜치에 push가 되면 실행됩니다 | ||
on: | ||
push: | ||
branches: [ "itsme-shawn" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
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' | ||
|
||
- name: Copy secret | ||
env: | ||
SECRET_APPLICATION: ${{ secrets.SECRET_APPLICATION }} | ||
SECRET_APPLICATION_PROD: ${{ secrets.SECRET_APPLICATION_PROD }} | ||
SECRET_JWT: ${{ secrets.SECRET_JWT }} | ||
SECRET_ENV: ${{ secrets.ENV_VARS }} | ||
DIR: src/main/resources | ||
FILENAME_APPLICATION: application.yml | ||
FILENAME_APPLICATION_PROD: application-prod.yml | ||
FILENAME_JWT: jwt.yml | ||
FILENAME_ENV : .env | ||
run: | | ||
echo "현재 디렉터리: $(pwd)" | ||
mkdir $DIR | ||
echo $SECRET_APPLICATION | base64 --decode > $DIR/$FILENAME_APPLICATION && | ||
echo $SECRET_APPLICATION_PROD | base64 --decode > $DIR/$FILENAME_APPLICATION_PROD && | ||
echo $SECRET_JWT | base64 --decode > $DIR/$FILENAME_JWT && | ||
echo $SECRET_ENV | base64 --decode > $FILENAME_ENV | ||
ls -al | ||
## gradle build | ||
- name: Build with Gradle | ||
run: ./gradlew bootJar | ||
|
||
|
||
## 웹 이미지 빌드 및 도커허브에 push | ||
- name: web docker build and push | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker-compose -f docker-compose-prod.yml build | ||
docker push soul4927/ceos-spring | ||
- name: executing remote ssh commands using password | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.KEY }} | ||
script: | | ||
## 여러분이 원하는 경로로 이동합니다. | ||
cd /home/ubuntu/ | ||
## docker-compose를 실행합니다. | ||
sudo chmod 666 /var/run/docker.sock | ||
sudo docker rm -f $(docker ps -qa) | ||
sudo docker pull soul4927/ceos-spring | ||
sudo docker-compose -f docker-compose-prod.yml up -d | ||
docker image prune -f |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: "3.7" | ||
services: | ||
web: | ||
platform: linux/amd64 # 플랫폼 설정 | ||
image: soul4927/ceos-spring:latest | ||
container_name: spring-daangn-server | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "80:8080" | ||
environment: | ||
- SPRING_PROFILES_ACTIVE=prod | ||
|
Binary file not shown.