CodeSection

apps/www/src/components/CodeSection.astro · 23 lines · group Misc

Used by

Live sites: pages.gitt.one.

Samples 1

pages.gitt.one/how-it-works/

The whole build configuration of a site

This is not an excerpt — a content repository really is this small. The image paths are a public contract: they do not move under your feet.

Knowledge base

A repository of markdown files becomes a documentation site.

Dockerfile
FROM h.gitt.one/pages/engine-astro/builder-docs:latest AS builder

RUN rm -rf src/content/docs/*
COPY . src/content/docs/
COPY pages.config.js ./
RUN pnpm run build

FROM h.gitt.one/commons/nginx-basicauth:master AS runner
COPY --from=builder /src/apps/docs/dist /usr/share/nginx/html

Plus a three-line .gitlab-ci.yml and pages.config.js with the site title and URL.

Landing page

Content, images and assets are copied over the examples shipped in the image.

Dockerfile
FROM h.gitt.one/pages/engine-astro/builder-www:latest AS builder

RUN rm -rf src/articles/* src/images/*
COPY articles/ src/articles/
COPY images/ src/images/
COPY pages.config.js ./
RUN pnpm run build

FROM h.gitt.one/pages/engine-astro/nginx:latest
COPY --from=builder /src/apps/www/dist /usr/share/nginx/html

The runner image already serves with compression, caching rules and a 404 page — nothing to configure.

MDX of this sample
export const DOCS_DOCKERFILE = `FROM h.gitt.one/pages/engine-astro/builder-docs:latest AS builder

RUN rm -rf src/content/docs/*
COPY . src/content/docs/
COPY pages.config.js ./
RUN pnpm run build

FROM h.gitt.one/commons/nginx-basicauth:master AS runner
COPY --from=builder /src/apps/docs/dist /usr/share/nginx/html`;
export const WWW_DOCKERFILE = `FROM h.gitt.one/pages/engine-astro/builder-www:latest AS builder

RUN rm -rf src/articles/* src/images/*
COPY articles/ src/articles/
COPY images/ src/images/
COPY pages.config.js ./
RUN pnpm run build

FROM h.gitt.one/pages/engine-astro/nginx:latest
COPY --from=builder /src/apps/www/dist /usr/share/nginx/html`;

<CodeSection
  title="The whole build configuration of a site"
  description="This is not an excerpt — a content repository really is this small. The image paths are a public contract: they do not move under your feet."
>
  <CodeItem
    title="Knowledge base"
    fileName="Dockerfile"
    description="A repository of markdown files becomes a documentation site."
    code={DOCS_DOCKERFILE}
    note="Plus a three-line .gitlab-ci.yml and pages.config.js with the site title and URL."
  />
  <CodeItem
    title="Landing page"
    fileName="Dockerfile"
    description="Content, images and assets are copied over the examples shipped in the image."
    code={WWW_DOCKERFILE}
    note="The runner image already serves with compression, caching rules and a 404 page — nothing to configure."
  />
</CodeSection>

Props

NameTypeRequiredDefaultDescription
titlestringyes
descriptionstring

Source apps/www/src/components/CodeSection.astro @ gitt.one

---
interface Props {
  title: string;
  description?: string;
}

const { title, description } = Astro.props;
---

<div class="bg-white">
  <div class="max-w-7xl mx-auto py-16 px-4 sm:px-6 lg:py-24 lg:px-8">
    <div class="max-w-3xl">
      <h2 class="text-3xl font-extrabold tracking-tight text-gray-900 sm:text-4xl">
        {title}
      </h2>
      {description && <p class="mt-4 text-lg text-gray-500">{description}</p>}
    </div>
    <div class="mt-12 grid grid-cols-1 gap-8 lg:grid-cols-2">
      <slot />
    </div>
  </div>
</div>

Source links point to engine-astro@e857a859. Samples are cut from the sites' own content by scripts/gallery-extract.mjs; nothing is merged or removed yet.