chore: cd self-hosted ๋ณ๊ฒฝ #24
Workflow file for this run
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
name: Main Branch CI Pipeline | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
# ๋ฐ์ดํฐ๋ฒ ์ด์ค ํ๊ฒฝ๋ณ์ (RDS) | |
DB_URL: ${{ secrets.DB_URL }} | |
DB_USERNAME: ${{ secrets.DB_USERNAME }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
## Redis ํ๊ฒฝ๋ณ์ | |
REDIS_HOST: ${{ secrets.REDIS_HOST }} | |
REDIS_PORT: ${{ secrets.REDIS_PORT }} | |
# FCM ํ๊ฒฝ๋ณ์ | |
BOTTLER_FCM_BASE64: ${{ secrets.BOTTLER_FCM_BASE64 }} | |
# AWS ํ๊ฒฝ๋ณ์ | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
# ECR ํ๊ฒฝ๋ณ์ | |
ECR_URI: ${{ secrets.ECR_URI }} | |
# S3 ํ๊ฒฝ๋ณ์ | |
BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
BASE_URL: ${{ secrets.BASE_URL }} | |
# gpt ํ๊ฒฝ๋ณ์ | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
steps: | |
- name: ์ฝ๋ ๊ฐ์ ธ์ค๊ธฐ | |
uses: actions/checkout@v4 | |
- name: JDK 17 ์ค์ | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2.6.0 | |
- name: Execute Gradle build | |
run: | | |
cd backend/bottler # ํ๋ก์ ํธ ์์น์ ๋ง๊ฒ ์ถํ ์์ | |
./gradlew build | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2.2.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Image Build | |
run: | | |
cd backend/bottler | |
docker build --platform linux/arm64/v8 -t l2yupa/bottler -f Dockerfile-dev . | |
- name: Docker Hub Push | |
run: docker push l2yupa/bottler | |
deploy: | |
runs-on: [self-hosted, Linux, 64] | |
needs: build | |
steps: | |
- name: Pull Latest Docker Image | |
run: | | |
sudo docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }} | |
sudo docker pull l2yupa/bottler | |
- name: Docker Compose | |
run: | | |
sudo docker run --name spring-baton -p 8080:8080 2023baton/2023baton:latest 1>> build.log 2>> error.log & |