From ca08f7a2e6cc89008769a7a69e327edd62d9021c Mon Sep 17 00:00:00 2001 From: tolelom <98kimsungmin@naver.com> Date: Tue, 24 Feb 2026 11:32:42 +0900 Subject: [PATCH] =?UTF-8?q?CI/CD:=20Gitea=20Actions=20=EB=B0=B0=ED=8F=AC?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=B4=ED=94=84=EB=9D=BC=EC=9D=B8=20=EB=B0=8F=20?= =?UTF-8?q?Docker=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/deploy.yml | 28 ++++++++++++++++++++++++++++ Dockerfile | 14 ++++++++++++++ nginx.conf | 14 ++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..07b1666 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,28 @@ +name: Client CI/CD + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: 서버에 배포 + uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + script: | + export PATH=$PATH:/usr/local/bin:/opt/homebrew/bin:$HOME/.docker/bin + cd /tmp + rm -rf a301-client + git clone https://tolelom:${{ secrets.GIT_TOKEN }}@git.tolelom.xyz/A301/a301_client.git a301-client + cd a301-client + docker build --no-cache -t a301-client:latest . + cd ~/server + docker compose up -d --force-recreate a301-client + rm -rf /tmp/a301-client diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d8d8936 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Stage 1: Build +FROM node:lts-alpine AS builder +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build + +# Stage 2: Serve with Nginx +FROM nginx:alpine +COPY --from=builder /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..2a12dc8 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,14 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + # SPA fallback (react-router 사용 시 필요) + location / { + try_files $uri $uri/ /index.html; + } + + gzip on; + gzip_types text/plain text/css application/javascript application/json image/svg+xml; + gzip_min_length 1024; +} \ No newline at end of file