-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: deploy 파이프라인을 구성한다 * fix: 필요없는 move jar step을 제거한다 * fix: Dockerfile의 JAR_FILE 찾는 위치를 build하위로 변경한다 * test: 롤백! 테스트를 위해 이미지 버저닝 제거 * ci: Dockerfile version을 수정한다 * test: 테스트를 위해 버저닝 제거 리버트하기 * fix: 서버 실행 플랫폼을 linux/amd64로 변경한다 * fix: 리버트 test3 * refactor: network를 docker-compose..로 수정한다 * refactor: CLOVA_AUTHORIZATION 시크릿을 추가한다 * test: 리버트 test4 * Revert "test: 리버트 test4" This reverts commit fa07429. * Revert "fix: 리버트 test3" This reverts commit 827f8b0. * Revert "test: 테스트를 위해 버저닝 제거 리버트하기" This reverts commit 58a87e6. * Revert "test: 롤백! 테스트를 위해 이미지 버저닝 제거" This reverts commit f452449. * cd: Deployer 테스트용 trigger 조건을 삭제한다
- Loading branch information
Showing
2 changed files
with
111 additions
and
0 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,85 @@ | ||
name: 🎇 Deployer | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'release' | ||
|
||
jobs: | ||
build: | ||
name: build and set image | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
kotlin-version: [ 1.9.22 ] | ||
java-version: [ 21 ] | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up JDK 21 and Kotlin 1.9.22 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: ${{ matrix.java-version }} | ||
kotlin-version: ${{ matrix.kotlin-version }} | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
|
||
- name: build server | ||
run: ./gradlew build | ||
|
||
- name: docker arm64 build set up - qemu | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: docker arm64 build set up - buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: login github container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- name: extract version | ||
run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" | ||
id: extract_version_name | ||
|
||
- name: build and push api server | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
ghcr.io/nexters/misikapi/misikapi:${{ steps.extract_version_name.outputs.version }} | ||
build-args: | | ||
"DB_URL=${{ secrets.DB_URL }}" | ||
"DB_USERNAME=${{ secrets.DB_USERNAME }}" | ||
"DB_PASSWORD=${{ secrets.DB_PASSWORD }}" | ||
"REDIS_HOST=${{ secrets.REDIS_HOST }}" | ||
"REDIS_PORT=${{ secrets.REDIS_PORT }}" | ||
"CLOVA_AUTHORIZATION=${{ secrets.CLOVA_AUTHORIZATION }}" | ||
deploy: | ||
needs: build | ||
name: deploy | ||
runs-on: self-hosted | ||
steps: | ||
- name: extract version | ||
run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" | ||
id: extract_version_name | ||
|
||
- name: run api server | ||
run: | | ||
sudo docker pull ghcr.io/nexters/misikapi/misikapi:${{ steps.extract_version_name.outputs.version }} | ||
sudo docker ps -q --filter "expose=8080" | xargs sudo docker stop | xargs sudo docker rm | ||
sudo docker run -d -p 8080:8080 --network docker-compose_misik_api_network ghcr.io/nexters/misikapi/misikapi:${{ steps.extract_version_name.outputs.version }} |
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,26 @@ | ||
FROM openjdk:21-jdk | ||
|
||
ARG DB_URL | ||
ARG DB_USERNAME | ||
ARG DB_PASSWORD | ||
ARG REDIS_HOST | ||
ARG REDIS_PORT | ||
ARG CLOVA_AUTHORIZATION | ||
|
||
ARG JAR_FILE=./build/libs/*.jar | ||
COPY ${JAR_FILE} misik-api.jar | ||
|
||
ENV db_url=${DB_URL} \ | ||
db_username=${DB_USERNAME} \ | ||
db_password=${DB_PASSWORD} \ | ||
redis_host=${REDIS_HOST} \ | ||
redis_port=${REDIS_PORT} \ | ||
clova_authorization=${CLOVA_AUTHORIZATION} | ||
|
||
ENTRYPOINT java -jar misik-api.jar \ | ||
--spring.datasource.url=${db_url} \ | ||
--spring.datasource.username=${db_username} \ | ||
--spring.datasource.password=${db_password} \ | ||
--netx.host=${redis_host} \ | ||
--netx.port=${redis_port} \ | ||
--me.misik.chatbot.clova.authorization=${clova_authorization} |