From 4b321c1991a70a0994fc02f95bec65808b51d574 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Fri, 30 Oct 2026 09:00:39 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B0=B0=ED=8F=AC=20=EB=95=8C=20?= =?UTF-8?q?=EC=98=88=EC=A0=84=20=EB=B9=8C=EB=93=9C=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=9D=84=202=EC=A3=BC=20=EB=82=A8=EA=B9=80=20=E2=80=94=20?= =?UTF-8?q?=EC=97=B4=EC=96=B4=20=EB=91=94=20=ED=83=AD(=ED=8F=B0=20?= =?UTF-8?q?=ED=81=AC=EB=A1=AC)=EA=B3=BC=20=EA=B5=AC=EA=B8=80=20=EB=A0=8C?= =?UTF-8?q?=EB=8D=94=EA=B0=80=20=EC=98=88=EC=A0=84=20HTML=20=EB=A1=9C=20?= =?UTF-8?q?=EC=A7=80=EC=9B=8C=EC=A7=84=20=ED=8C=8C=EC=9D=BC=EC=9D=84=20?= =?UTF-8?q?=EB=B6=88=EB=9F=AC=20'=EB=82=A0=EC=94=A8=20=EB=B6=88=EB=9F=AC?= =?UTF-8?q?=EC=98=A4=EB=8A=94=20=EC=A4=91'=EC=97=90=EC=84=9C=20=EB=A9=88?= =?UTF-8?q?=EC=B6=94=EB=8D=98=20=EA=B2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.sh | 6 ++++++ frontend/.gitignore | 4 ++++ frontend/.old-assets/.gitkeep | 0 frontend/Dockerfile | 2 ++ 4 files changed, 12 insertions(+) create mode 100644 frontend/.old-assets/.gitkeep diff --git a/deploy.sh b/deploy.sh index 9dadf32..1c240c7 100755 --- a/deploy.sh +++ b/deploy.sh @@ -17,6 +17,12 @@ if [ -z "${DEPLOY_PULLED:-}" ]; then fi docker compose up -d --wait postgres redis docker compose exec -T postgres psql -q -v ON_ERROR_STOP=1 -U "$DB_USER" -d "$DB_NAME" < backend/postgres-init/init.sql +# 지금 빌드 파일을 모아 새 이미지에 같이 넣는다. 배포로 지우면 열어 둔 탭과 구글 렌더가 예전 HTML 로 없는 파일을 불러 첫 화면에서 멈춘다 (2주 지난 건 지움) +mkdir -p frontend/.old-assets +if [ -n "$(docker compose ps -q frontend)" ]; then + docker compose cp frontend:/usr/share/nginx/html/assets/. frontend/.old-assets/ +fi +find frontend/.old-assets -type f ! -name .gitkeep -mtime +14 -delete docker compose up -d --build backend worker frontend docker compose exec -T backend python scripts/load_seed.py # 피드 캐시는 최대 1시간이라, 각 규칙이 바뀌어도 오늘 탭만 옛 순위로 남는다 diff --git a/frontend/.gitignore b/frontend/.gitignore index e2319c9..43233fe 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -25,3 +25,7 @@ dist-ssr dist-toss *.ait + +# deploy.sh 가 모아 두는 지난 배포 빌드 파일 +.old-assets/* +!.old-assets/.gitkeep diff --git a/frontend/.old-assets/.gitkeep b/frontend/.old-assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 7a4daee..2849f3f 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -32,6 +32,8 @@ RUN npm run build # ---- prod: nginx로 정적 파일 제공 ---- FROM nginx:1.29-alpine AS prod COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf +# 지난 배포의 빌드 파일(deploy.sh 가 모아 둠). 이미 열어 둔 탭·구글 렌더가 예전 HTML 로 예전 파일을 불러도 뜨게 한다 +COPY frontend/.old-assets/ /usr/share/nginx/html/assets/ COPY --from=build /app/frontend/dist /usr/share/nginx/html EXPOSE 80 HEALTHCHECK --interval=30s --timeout=3s CMD wget -q -O /dev/null http://127.0.0.1/ || exit 1