diff --git a/apps/website/.dockerignore b/apps/website/.dockerignore new file mode 100644 index 0000000..7730896 --- /dev/null +++ b/apps/website/.dockerignore @@ -0,0 +1,6 @@ +node_modules +.nuxt +.output +.git +dist +*.log diff --git a/apps/website/Dockerfile b/apps/website/Dockerfile new file mode 100644 index 0000000..a416f89 --- /dev/null +++ b/apps/website/Dockerfile @@ -0,0 +1,25 @@ +# Production image for the dezky marketing site (Nuxt 4 SSR). +# Build context = this directory (apps/website). In Coolify set the build pack +# to "Dockerfile" and Base Directory to apps/website. +# syntax=docker/dockerfile:1 + +FROM node:22-alpine AS build +WORKDIR /app +RUN corepack enable +# Install deps first for layer caching (pnpm version comes from packageManager). +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile +COPY . . +RUN pnpm build + +FROM node:22-alpine AS runtime +WORKDIR /app +ENV NODE_ENV=production +ENV HOST=0.0.0.0 +ENV PORT=3000 +# Absolute canonical / OG / sitemap URLs. Override in Coolify if the domain +# differs (e.g. a staging URL). +ENV NUXT_PUBLIC_SITE_URL=https://dezky.eu +COPY --from=build /app/.output ./.output +EXPOSE 3000 +CMD ["node", ".output/server/index.mjs"] diff --git a/apps/website/nuxt.config.ts b/apps/website/nuxt.config.ts index 06ce2b4..87769ab 100644 --- a/apps/website/nuxt.config.ts +++ b/apps/website/nuxt.config.ts @@ -6,6 +6,8 @@ // the Docker app stack. Locally it runs behind Traefik at dezky.local / // www.dezky.local with the same mkcert TLS as the rest of the platform. +import { existsSync } from 'node:fs' + const siteUrl = process.env.NUXT_PUBLIC_SITE_URL || (process.env.NODE_ENV === 'production' ? 'https://dezky.eu' : 'http://localhost:3000') @@ -25,7 +27,12 @@ export default defineNuxtConfig({ // CountrySelect.vue is just . Mirrors portal/operator. components: [ '~/components', - { path: '/shared-packages/ui/components', pathPrefix: false }, + // The shared @dezky/ui dir is bind-mounted in the Docker dev stack; include + // it only when present so standalone builds (e.g. Coolify) don't warn on + // the missing absolute path. The marketing site uses no shared component. + ...(existsSync('/shared-packages/ui/components') + ? [{ path: '/shared-packages/ui/components', pathPrefix: false }] + : []), ], app: { diff --git a/apps/website/package.json b/apps/website/package.json index 01ac01b..57ca37e 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "TMPDIR=/tmp nuxt dev --host 0.0.0.0 --port 3000", "build": "nuxt build", + "start": "node .output/server/index.mjs", "generate": "nuxt generate", "preview": "nuxt preview", "typecheck": "nuxt typecheck",