diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c90a450..26f03c5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,6 +30,7 @@ jobs: env: DISABLE_REACT_COMPILER: "1" NEXT_TELEMETRY_DISABLED: "1" + NEXT_PUBLIC_SITE_URL: https://aut.insaight.net run: | set -euo pipefail npm ci --no-audit --no-fund @@ -46,16 +47,22 @@ jobs: # Flatten standalone to artifact root (includes .next + node_modules) cp -a .next/standalone/. prebuilt/ - # Static assets + public (required next to standalone) - cp -a .next/static prebuilt/.next/static + # Next must NOT see a root-level ./static (legacy); only ./.next/static + rm -rf prebuilt/static + rm -rf prebuilt/.next/static + mkdir -p prebuilt/.next + cp -a .next/static/. prebuilt/.next/static/ + if [ -d public ]; then + rm -rf prebuilt/public cp -a public prebuilt/public else mkdir -p prebuilt/public fi - # Dockerfile travels with the artifact so deploy context is self-contained + # Build recipe for deploy job (excluded from image via .dockerignore) cp Dockerfile.prebuilt prebuilt/Dockerfile + printf '%s\n' 'Dockerfile' '.dockerignore' > prebuilt/.dockerignore echo "Assembled tree:" ls -la prebuilt @@ -64,6 +71,11 @@ jobs: test -f prebuilt/.next/BUILD_ID test -d prebuilt/.next/static test -d prebuilt/node_modules + # Fail if legacy root static leaked in + if [ -e prebuilt/static ]; then + echo "ERROR: root-level static/ must not exist" >&2 + exit 1 + fi - uses: actions/upload-artifact@v4 with: @@ -102,7 +114,7 @@ jobs: # Confirm BUILD_ID is actually inside the image docker run --rm --entrypoint sh "$IMAGE_NAME" -c \ - 'test -f /app/.next/BUILD_ID && test -f /app/server.js && ls -la /app/.next' + 'test -f /app/.next/BUILD_ID && test -f /app/server.js && test -d /app/.next/static && test ! -e /app/static && ls -la /app && ls -la /app/.next' - name: Restart container env: diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..2698ca2 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000..2698ca2 Binary files /dev/null and b/public/favicon.png differ diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 011b915..2f81f80 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -54,17 +54,22 @@ const iranSans = localFont({ export async function generateMetadata(): Promise { const t = await getTranslations("meta"); + const siteUrl = + process.env.NEXT_PUBLIC_SITE_URL ?? "https://aut.insaight.net"; return { - metadataBase: new URL("https://openedu.aut.ac.ir"), + metadataBase: new URL(siteUrl), title: { default: t("homeTitle"), template: `%s | ${t("homeTitle")}`, }, description: t("homeDescription"), icons: { - icon: [{ url: "/brand/amirkabir.png", type: "image/png" }], + icon: [ + { url: "/brand/amirkabir.png", sizes: "32x32", type: "image/png" }, + { url: "/brand/amirkabir.png", sizes: "192x192", type: "image/png" }, + ], apple: [{ url: "/brand/amirkabir.png", type: "image/png" }], - shortcut: "/brand/amirkabir.png", + shortcut: ["/brand/amirkabir.png"], }, openGraph: { type: "website",