From d82bbacaaa6d7440ae8b4039ee5275ac46e1bfb1 Mon Sep 17 00:00:00 2001 From: ga111o Date: Sun, 3 Aug 2025 20:36:56 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=99=98=EA=B2=BD=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=20=EA=B8=B0=EB=B0=98=20API=20=EB=8F=84=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EB=B0=8F=20Dockerfile=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image.yaml | 4 +++- .gitignore | 2 ++ Dockerfile | 8 +++++++- package-lock.json | 13 ------------- src/services/api.ts | 4 +++- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker-image.yaml b/.github/workflows/docker-image.yaml index c6adab1..59a548d 100644 --- a/.github/workflows/docker-image.yaml +++ b/.github/workflows/docker-image.yaml @@ -16,7 +16,9 @@ jobs: - name: Build and tag Docker image run: | - docker build --no-cache -t ${{ secrets.DOCKER_HUB_USERNAME }}/kws_fe:latest . + docker build --no-cache \ + --build-arg VITE_API_DOMAIN=${{ secrets.VITE_API_DOMAIN }} \ + -t ${{ secrets.DOCKER_HUB_USERNAME }}/kws_fe:latest . docker tag ${{ secrets.DOCKER_HUB_USERNAME }}/kws_fe:latest ${{ secrets.DOCKER_HUB_USERNAME }}/kws_fe:latest - name: Deploy container locally diff --git a/.gitignore b/.gitignore index a547bf3..3b0b403 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? + +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 88fdd8e..79b9f81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,14 @@ WORKDIR /app COPY package*.json ./ RUN npm install --legacy-peer-deps -# 애플리케이션 코드 복사 및 빌드 +# 애플리케이션 코드 복사 COPY . . + +# 빌드 시 환경 변수 설정 +ARG VITE_API_DOMAIN +ENV VITE_API_DOMAIN=${VITE_API_DOMAIN} + +# 애플리케이션 빌드 RUN npm run build # Step 2: Serve the built app with Nginx diff --git a/package-lock.json b/package-lock.json index 1c738a8..a9be406 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4591,19 +4591,6 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, - "node_modules/yaml": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz", - "integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==", - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/src/services/api.ts b/src/services/api.ts index 29b9553..26f1ee2 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -1,8 +1,10 @@ import axios from "axios"; import Cookies from "js-cookie"; +const API_DOMAIN = import.meta.env.VITE_API_DOMAIN; + const axiosClient = axios.create({ - baseURL: "http://100.101.247.128:25121/api", + baseURL: `http://${API_DOMAIN}/api`, headers: { "Content-Type": "application/json", },