Skip to content
Merged
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
37 changes: 37 additions & 0 deletions .github/workflows/docker-image-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CD Pipeline

on:
workflow_run:
# CI Pipeline이 실행된 후 실행
workflows: [ "CI Pipeline" ]
types:
- completed


jobs:
deploy:

# 리눅스 서버의 Runner에서 실행
runs-on: self-hosted
steps:

# 현재 레포지토리 가져오기
- name: Checkout repository
uses: actions/checkout@v4

# Docker 로그인
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

# Docker 이미지 Pull
- name: Pull Docker image
run: docker pull $DOCKER_USERNAME/lpilogue-fe:latest
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

# react-app만 다시 실행
- name: Run Docker compose
run: docker compose rm -f react-app && docker compose up -d react-app
53 changes: 53 additions & 0 deletions .github/workflows/docker-image-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI Pipeline

on:
push:
branches: [ "main" ]


jobs:

build:

runs-on: ubuntu-latest

steps:
# 현재 레포지토리 가져오기
- name: Checkout repository
uses: actions/checkout@v4

# Node.js 환경 설정
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22.11.0'
cache: 'npm'

# 의존성 설치
- name: Install dependencies
run: npm ci

# React 앱 빌드
- name: Build React app
run: npm run build
env:
CI: false

# Docker Hub 로그인
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

# Docker 이미지 빌드 및 푸시
- name: Build and push the Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/lpilogue-fe:latest
${{ secrets.DOCKER_USERNAME }}/lpilogue-fe:${{ github.run_id }}


61 changes: 61 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
services:
react-app:
container_name: lpilogue-fe
restart: on-failure
image: hadoroke/lpilogue-fe:latest
ports:
- "3000:3000"
environment:
BE_HOST: "lpilogue-be"
BE_PORT: "8080"
REC_HOST: "lpilogue-rec"
REC_PORT: "5000"


spring-boot-app:
container_name: lpilogue-be
restart: on-failure
image: hadoroke/lpilogue-be:latest
ports:
- "52781:8080"
environment:
SPRING_PROFILES_ACTIVE: "prod"
SPRING_DATASOURCE_URL: jdbc:mysql://lpilogue-db:3306/lpilogue?serverTimezone=Asia/Seoul&useSSL=false&allowPublicKeyRetrieval=true
# SPRING_DATASOURCE_URL: jdbc:mysql://lpilogue-db.c5msg0qqmmcw.ap-northeast-2.rds.amazonaws.com:3306/lpilogue?serverTimezone=Asia/Seoul&useSSL=false&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME: admin
SPRING_DATASOURCE_PASSWORD: dnwnswls2501
TZ: Asia/Seoul
depends_on:
- mysql-app

mysql-app:
container_name: lpilogue-db
image: mysql:8
restart: always
environment:
MYSQL_DATABASE: lpilogue
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_USER: admin
MYSQL_PASSWORD: dnwnswls2501
TZ: Asia/Seoul
ports:
- "3306:3306"
volumes:
- /mnt/tank/databases/mysql:/var/lib/mysql # TrueNAS 디스크 마운트 경로

flask-app:
container_name: lpilogue-rec
restart: on-failure
image: hadoroke/lpilogue-rec:latest
environment:
TZ: Asia/Seoul
ports:
- "59999:5000"
depends_on:
- mysql-app

cloudflare-app:
container_name: cloudflare
restart: unless-stopped
image: cloudflare/cloudflared:latest
command: tunnel --no-autoupdate run --token eyJhIjoiM2FhNmJmMjU1NzdmMDQ1OThhMjYyMGEwMzg4OWVkMzYiLCJ0IjoiM2EzNTk5MTItNmZhYi00OGM0LWIxMDktODRhOTFjMzVmN2MwIiwicyI6Ik9UVm1NV1l3TW1RdE9XWTNOQzAwWkdRd0xXRTJZalV0TldSaFpESTBZek01TjJGbSJ9
Loading