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
4 changes: 2 additions & 2 deletions apps/app/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ phases:
- |
if [ -d ".next/static" ]; then
echo "📦 Uploading .next/static/ files to CDN..."
aws s3 sync .next/static/ s3://$STATIC_ASSETS_BUCKET/_next/static/ \
aws s3 sync .next/static/ s3://$STATIC_ASSETS_BUCKET/app/_next/static/ \
--cache-control "public, max-age=31536000, immutable" \
--exclude "*.map"
echo "✅ Uploaded Next.js static assets to S3"
Expand All @@ -64,7 +64,7 @@ phases:
- |
if [ -d "public" ]; then
echo "📦 Uploading public/ files to S3..."
aws s3 sync public/ s3://$STATIC_ASSETS_BUCKET/ \
aws s3 sync public/ s3://$STATIC_ASSETS_BUCKET/app/ \
--cache-control "public, max-age=86400" \
--exclude "*.map" \
--exclude "_next/*"
Expand Down
31 changes: 29 additions & 2 deletions apps/app/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import path from 'path';
import './src/env.mjs';

const config: NextConfig = {
// Use S3 bucket for static assets
assetPrefix: process.env.NODE_ENV === 'production' ? process.env.STATIC_ASSETS_URL : '',
// Use S3 bucket for static assets with app-specific path
assetPrefix: process.env.NODE_ENV === 'production' ? `${process.env.STATIC_ASSETS_URL}/app` : '',
poweredByHeader: false,
reactStrictMode: true,
transpilePackages: ['@trycompai/db'],
Expand Down Expand Up @@ -84,6 +84,33 @@ const config: NextConfig = {
},
];
},
async redirects() {
if (process.env.NODE_ENV === 'production' && process.env.STATIC_ASSETS_URL) {
return [
{
source: '/favicon.ico',
destination: `${process.env.STATIC_ASSETS_URL}/app/favicon.ico`,
permanent: true,
},
{
source: '/favicon-96x96.png',
destination: `${process.env.STATIC_ASSETS_URL}/app/favicon-96x96.png`,
permanent: true,
},
{
source: '/apple-touch-icon.png',
destination: `${process.env.STATIC_ASSETS_URL}/app/apple-touch-icon.png`,
permanent: true,
},
{
source: '/site.webmanifest',
destination: `${process.env.STATIC_ASSETS_URL}/app/site.webmanifest`,
permanent: true,
},
];
}
return [];
},
async rewrites() {
return [
{
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export default async function Layout({ children }: { children: React.ReactNode }
return (
<html lang="en" suppressHydrationWarning>
<head>
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" href="/favicon-96x96.png" type="image/png" sizes="96x96" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180" />
<link rel="manifest" href="/site.webmanifest" />
{dubIsEnabled && dubReferUrl && (
<DubAnalytics
domainsConfig={{
Expand Down
4 changes: 2 additions & 2 deletions apps/portal/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ phases:
- |
if [ -d ".next/static" ]; then
echo "📦 Uploading .next/static/ files to CDN..."
aws s3 sync .next/static/ s3://$STATIC_ASSETS_BUCKET/_next/static/ \
aws s3 sync .next/static/ s3://$STATIC_ASSETS_BUCKET/portal/_next/static/ \
--cache-control "public, max-age=31536000, immutable" \
--exclude "*.map"
echo "✅ Uploaded Next.js static assets to S3"
Expand All @@ -62,7 +62,7 @@ phases:
- |
if [ -d "public" ]; then
echo "📦 Uploading public/ files to S3..."
aws s3 sync public/ s3://$STATIC_ASSETS_BUCKET/ \
aws s3 sync public/ s3://$STATIC_ASSETS_BUCKET/portal/ \
--cache-control "public, max-age=86400" \
--exclude "*.map" \
--exclude "_next/*"
Expand Down
32 changes: 30 additions & 2 deletions apps/portal/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import path from 'path';
import './src/env.mjs';

const config: NextConfig = {
// Use S3 bucket for static assets
assetPrefix: process.env.NODE_ENV === 'production' ? process.env.STATIC_ASSETS_URL : '',
// Use S3 bucket for static assets with portal-specific path
assetPrefix:
process.env.NODE_ENV === 'production' ? `${process.env.STATIC_ASSETS_URL}/portal` : '',
transpilePackages: ['@trycompai/db'],
outputFileTracingRoot: path.join(__dirname, '../../'),
outputFileTracingIncludes: {
Expand All @@ -18,6 +19,33 @@ const config: NextConfig = {
},
],
},
async redirects() {
if (process.env.NODE_ENV === 'production' && process.env.STATIC_ASSETS_URL) {
return [
{
source: '/favicon.ico',
destination: `${process.env.STATIC_ASSETS_URL}/portal/favicon.ico`,
permanent: true,
},
{
source: '/favicon-96x96.png',
destination: `${process.env.STATIC_ASSETS_URL}/portal/favicon-96x96.png`,
permanent: true,
},
{
source: '/apple-touch-icon.png',
destination: `${process.env.STATIC_ASSETS_URL}/portal/apple-touch-icon.png`,
permanent: true,
},
{
source: '/site.webmanifest',
destination: `${process.env.STATIC_ASSETS_URL}/portal/site.webmanifest`,
permanent: true,
},
];
}
return [];
},
async rewrites() {
return [
{
Expand Down
6 changes: 6 additions & 0 deletions apps/portal/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ export default async function Layout(props: { children: React.ReactNode }) {

return (
<html lang="en" suppressHydrationWarning>
<head>
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" href="/favicon-96x96.png" type="image/png" sizes="96x96" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180" />
<link rel="manifest" href="/site.webmanifest" />
</head>
<body
className={cn(
`${GeistMono.variable} ${font.variable}`,
Expand Down
Loading