ci: 빌드 시 VITE_API_BASE_URL을 build arg로 주입
All checks were successful
Client CI/CD / deploy (push) Successful in 12s

Vite는 빌드 타임에 환경변수를 번들에 포함하므로
서버 secrets에서 VITE_API_BASE_URL을 받아 docker build 시 전달

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 14:35:09 +09:00
parent 86c6720f30
commit 2f56dfb519
2 changed files with 4 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ jobs:
rm -rf a301-client rm -rf a301-client
git clone https://tolelom:${{ secrets.GIT_TOKEN }}@git.tolelom.xyz/A301/a301_client.git a301-client git clone https://tolelom:${{ secrets.GIT_TOKEN }}@git.tolelom.xyz/A301/a301_client.git a301-client
cd a301-client cd a301-client
docker build --no-cache -t a301-client:latest . docker build --no-cache --build-arg VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }} -t a301-client:latest .
cd ~/server cd ~/server
docker compose up -d --force-recreate a301-client docker compose up -d --force-recreate a301-client
rm -rf /tmp/a301-client rm -rf /tmp/a301-client

View File

@@ -4,6 +4,8 @@ WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm ci --legacy-peer-deps RUN npm ci --legacy-peer-deps
COPY . . COPY . .
ARG VITE_API_BASE_URL
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
RUN npm run build RUN npm run build
# Stage 2: Serve with Nginx # Stage 2: Serve with Nginx
@@ -11,4 +13,4 @@ FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]