Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/Docker-CI-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: DOCKER-CI-CD
on:
pull_request:
branches: [ "dev" ]

jobs:
ci:
runs-on: ubuntu-22.04
env:
working-directory: .

steps:
- name: 체크아웃
uses: actions/checkout@v3

- name: JDK 21 설치
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '21'

- name: application.yml 생성
run: |
mkdir -p ./src/main/resources && cd $_
touch ./application.yml
echo "${{ secrets.APPLICATION_DEV }}" > ./application.yml
cat ./application.yml
working-directory: ${{ env.working-directory }}

- name: 빌드
run: |
chmod +x gradlew
./gradlew build -x test
working-directory: ${{ env.working-directory }}
shell: bash


- name: docker 로그인
uses: docker/setup-buildx-action@v2.9.1

- name: docker hub 로그인
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKER_LOGIN_USERNAME }}
password: ${{ secrets.DOCKER_LOGIN_ACCESSTOKEN }}

- name: docker image 빌드 및 푸시
run: |
docker build --platform linux/amd64 -t offroadserver/admin-web .
docker push offroadserver/admin-web
working-directory: ${{ env.working-directory }}

cd:
needs: ci
runs-on: ubuntu-22.04

steps:
- name: docker 컨테이너 실행
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_KEY }}
script: |
cd ~
./deploy.sh
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM amd64/amazoncorretto:21
WORKDIR /app
COPY ./build/libs/*.jar /app/Orb-admin-web.jar
CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=dev", "Orb-admin-web.jar"]
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'org.springframework.boot:spring-boot-starter-actuator'

//db
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
Expand Down