Files
meezi/docker/website/Dockerfile
T
soroush.asadi 8ea98bdc09
CI/CD / CI · API (dotnet build + test) (push) Successful in 5m47s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 34s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m10s
CI/CD / CI · Admin Web (tsc) (push) Successful in 40s
CI/CD / CI · Website (tsc) (push) Successful in 47s
CI/CD / CI · Koja (tsc) (push) Successful in 51s
CI/CD / Deploy · all services (push) Successful in 3m53s
fix(seo): website/koja base URL defaulted to localhost → de-indexed in GSC
Production serves robots.txt Host/Sitemap, sitemap <loc>, and every page's
canonical + og:url as http://localhost:3010 — so Google rejects all URLs
("URL not allowed") and indexes nothing. Cause: NEXT_PUBLIC_SITE_URL is baked in
at BUILD time and was unset in prod, so it fell back to the localhost defaults in
the compose files + website Dockerfile.

Changes the defaults to the real domains (website → https://meezi.ir, koja →
https://koja.meezi.ir) in docker-compose.yml, docker-compose.full.yml, the
website Dockerfile ARG, and .env.example.

Build-time var → the website image MUST be rebuilt + redeployed (CI does this on
push), then purge the WCDN cache and resubmit the sitemap in Search Console.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 18:58:38 +03:30

57 lines
1.6 KiB
Docker

ARG NODE_IMAGE=mirror.soroushasadi.com/node:20-alpine
# ==================== DEPS STAGE ====================
FROM ${NODE_IMAGE} AS deps
WORKDIR /app
COPY web/website/package*.json ./
ARG NPM_REGISTRY=https://mirror.soroushasadi.com/repository/npm-group/
RUN npm ci --legacy-peer-deps --ignore-scripts \
--registry ${NPM_REGISTRY} \
--strict-ssl=false \
&& NEXT_VER=$(node -p "require('./node_modules/next/package.json').version") \
&& ls node_modules/@next/swc-linux-x64-musl 2>/dev/null \
|| npm install --no-save --ignore-scripts \
--registry ${NPM_REGISTRY} \
--strict-ssl=false \
"@next/swc-linux-x64-musl@${NEXT_VER}"
# ==================== BUILDER STAGE ====================
FROM ${NODE_IMAGE} AS builder
WORKDIR /app
ARG MEEZI_API_URL=http://api:8080
ARG NEXT_PUBLIC_SITE_URL=https://meezi.ir
ENV MEEZI_API_URL=$MEEZI_API_URL
ENV NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=deps /app/node_modules ./node_modules
COPY web/website/ .
RUN npm run build
# ==================== RUNNER STAGE ====================
FROM ${NODE_IMAGE} AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME=0.0.0.0
ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs \
&& adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder /app/src/content ./src/content
USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]