Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 개발 서버 (배포된 개발 환경)
VITE_API_URL=https://dev-api.ttorang.com
VITE_APP_TITLE=또랑 (개발)
18 changes: 16 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# ===========================================
# 환경변수 템플릿
# 이 파일을 복사해서 .env.local 파일을 만드세요
# ===========================================

# API
# API 서버 URL
# - 개발: https://dev-api.ttorang.com
# - 프로덕션: https://api.ttorang.com
VITE_API_URL=

# App
# 앱 타이틀
VITE_APP_TITLE=또랑

# ===========================================
# 시크릿 키 (반드시 .env.local에만 설정하세요)
# ===========================================

# 카카오 JavaScript 키 (공유 기능용)
# https://developers.kakao.com 에서 발급
VITE_KAKAO_JS_KEY=
3 changes: 3 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 프로덕션 서버
VITE_API_URL=https://api.ttorang.com
VITE_APP_TITLE=또랑
25 changes: 20 additions & 5 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge

on:
push:
branches:
- main

jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
env:
VITE_API_URL: ${{ secrets.VITE_API_URL }}
VITE_KAKAO_JS_KEY: ${{ secrets.VITE_KAKAO_JS_KEY }}

- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_TTORANG }}
Expand Down
26 changes: 21 additions & 5 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR

on: pull_request

permissions:
checks: write
contents: read
pull-requests: write

jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
env:
VITE_API_URL: ${{ secrets.VITE_API_URL }}
VITE_KAKAO_JS_KEY: ${{ secrets.VITE_KAKAO_JS_KEY }}

- name: Deploy Preview to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_TTORANG }}
Expand Down
47 changes: 42 additions & 5 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**/*.@(js|css|jpg|jpeg|png|gif|webp|svg|ico|woff|woff2)",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
},
Comment on lines 12 to 20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

자바스크립트/CSS 파일과 이미지/폰트 파일에 대한 캐싱 규칙이 동일한 Cache-Control 헤더를 사용하고 있습니다. 이 두 규칙을 하나로 병합하면 firebase.json 설정 파일을 더 간결하게 유지할 수 있습니다.

Suggested change
{
"source": "**/*.@(js|css)",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
},
{
"source": "**/*.@(jpg|jpeg|png|gif|webp|svg|ico|woff|woff2)",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
},
{
"source": "**/*.@(js|css|jpg|jpeg|png|gif|webp|svg|ico|woff|woff2)",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
},

{
"source": "index.html",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache, no-store, must-revalidate"
}
]
},
{
"source": "**",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' https://dev-api.ttorang.com https://api.ttorang.com https://developers.kakao.com; frame-ancestors 'none'"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "strict-origin-when-cross-origin"
}
]
}
]
}
}