Skip to content

Commit

Permalink
[fix] 빌드 오류 해결 (#155)
Browse files Browse the repository at this point in the history
* fix : 환경변수 수정

* fix : env 빌드 시간에 처리하기 위해서 ARG 명령어 사용

* fix : 의존성 부여를 위한 VITE_API_URL 추가
  • Loading branch information
ChoiSangwon authored Dec 6, 2023
1 parent d1ac3a3 commit 2c229be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy-front.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/front
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/front
cache-to: type=inline
build-args: VITE_API_URL=${{ secrets.VITE_API_URL }}

docker_pull_front:
name: Connect server ssh and pull frontend from container registry
Expand All @@ -48,7 +49,7 @@ jobs:
docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/front
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker run -d -p 80:80 -p 443:443 --env-file ${{ secrets.ENV_PATH }} --name front ${{ secrets.NCP_CONTAINER_REGISTRY }}/front
docker run -d -p 80:80 -p 443:443 --name front ${{ secrets.NCP_CONTAINER_REGISTRY }}/front
docker image prune -f
docker cp /etc/letsencrypt/archive/gbs-live.site/fullchain1.pem front:/
docker cp /etc/letsencrypt/archive/gbs-live.site/privkey1.pem front:/
Expand Down
7 changes: 6 additions & 1 deletion client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# 첫 번째 단계: 빌드 환경 구축
FROM --platform=linux/amd64 node:lts-alpine as build-stage

# 환경변수를 위한 ARG 지시어 추가
ARG VITE_API_URL

WORKDIR /app

# 의존성 파일 복사 및 설치
Expand All @@ -10,7 +13,9 @@ RUN yarn install && yarn global add typescript
# 소스 코드 복사
COPY . .

RUN ls -l
# .env 파일 생성
RUN echo "VITE_API_URL=$VITE_API_URL" > .env

# 애플리케이션 빌드
RUN yarn build

Expand Down

0 comments on commit 2c229be

Please sign in to comment.