Skip to content

Commit

Permalink
chore : xquare setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jidohyun committed Dec 20, 2024
1 parent 6d7cef6 commit 6e26ea1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 25 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/user-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
branches:
- dev
paths:
- 'packages/user/**'

jobs:
build:
permissions:
id-token: write
contents: read
name: Build
runs-on: ubuntu-latest
steps:
- name: Check Out The Repository
uses: actions/checkout@v3

- name: Deploy to xquare
uses: team-xquare/xquare-deployment-action@master
with:
environment: prod
access_key: ${{ secrets.ACCESS_KEY }}
base_url: packages/user
config_file_path: packages/user/.xquare/config.yaml
buildargs: |
BRANCH=dev
VITE_MAIN_URL=${{ secrets.PROD_VITE_MAIN_URL }}
VITE_SERVER_URL=${{ secrets.PROD_VITE_SERVER_URL }}
4 changes: 2 additions & 2 deletions packages/user/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_MAIN_URL=sillok.xquare.app
VITE_SERVER_URL=sillok-stag-server.xquare.app
PROD_VITE_MAIN_URL=sillok.xquare.app
PROD_VITE_SERVER_URL=sillok-stag-server.xquare.app
1 change: 1 addition & 0 deletions packages/user/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
.env

# Editor directories and files
.vscode/*
Expand Down
37 changes: 14 additions & 23 deletions packages/user/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,40 @@
# 빌드 단계
FROM node:22-alpine AS builder

# 필요한 패키지 설치
RUN apk add --no-cache libc6-compat git curl unzip
RUN apk add --no-cache libc6-compat git curl unzip file

# 환경 변수 설정
# ARG와 ENV 설정
ARG VITE_MAIN_URL
ARG VITE_SERVER_URL
ARG BRANCH=main

ENV VITE_MAIN_URL=${VITE_MAIN_URL}
ENV VITE_SERVER_URL=${VITE_SERVER_URL}

# 브랜치 설정
ARG BRANCH
ENV BRANCH=${BRANCH}

# GitHub 저장소에서 소스 다운로드 및 압축 해제
RUN curl -L -o ../Sillok_FE.zip https://github.com/Team-jeong-ho-kim/Sillok_FE/archive/${BRANCH}.zip && \
unzip ../Sillok_FE.zip -d /

# Yarn 설정
RUN corepack enable && corepack prepare [email protected] --activate
# 파일 다운로드 및 압축 해제
RUN echo "Downloading from: https://github.com/Team-jeong-ho-kim/Sillok_FE/archive/refs/heads/${BRANCH}.zip" && \
curl -L -o ../Sillok_FE.zip https://github.com/Team-jeong-ho-kim/Sillok_FE/archive/refs/heads/${BRANCH}.zip && \
unzip ../Sillok_FE.zip -d / && \
ls -l / && \
ls -l /Sillok_FE-${BRANCH}

# 작업 디렉토리 변경
# Yarn 설정 및 빌드
WORKDIR /Sillok_FE-${BRANCH}

# Yarn Berry 버전 사용
RUN corepack enable && corepack prepare [email protected] --activate
RUN yarn set version berry
RUN yarn install

# 특정 패키지 경로로 이동 후 빌드
# 패키지 디렉터리 확인
WORKDIR /Sillok_FE-${BRANCH}/packages/user
RUN yarn build
RUN ls -l && yarn build

# 실행 단계
FROM nginx:alpine AS runner

# 브랜치 환경 변수 설정
ARG BRANCH
ENV BRANCH=${BRANCH}

# Nginx 설정 파일 작성
RUN echo "\
server {\
listen 3000;\
Expand All @@ -51,11 +45,8 @@ server {\
}\
}" > /etc/nginx/conf.d/default.conf

# 빌드 결과물 복사
COPY --from=builder /Sillok_FE-${BRANCH}/packages/user/build /usr/share/nginx/html
COPY --from=builder /Sillok_FE-${BRANCH}/packages/user/dist /usr/share/nginx/html

# 포트 노출
EXPOSE 3000

# Nginx 실행
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 6e26ea1

Please sign in to comment.