fix: payload building issues
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
node_modules
|
||||
.next
|
||||
dist
|
||||
build
|
||||
.cache
|
||||
media
|
||||
uploads
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
*.log
|
||||
@@ -1,4 +1,4 @@
|
||||
# Payload
|
||||
# Payload (used for local dev via `pnpm dev:cms`)
|
||||
PAYLOAD_SECRET=change-me-to-a-long-random-string
|
||||
DATABASE_URI=postgres://payload:payload@localhost:5432/softvowels
|
||||
|
||||
@@ -9,8 +9,4 @@ SERVER_URL=https://cms.softvowels.example
|
||||
# Origins allowed to call the API (Astro public site)
|
||||
CORS_ORIGINS=https://softvowels.example,http://localhost:4321
|
||||
|
||||
# Internal rebuild webhook
|
||||
ASTRO_REVALIDATE_URL=http://host.docker.internal:4321/__revalidate
|
||||
ASTRO_REVALIDATE_TOKEN=change-me
|
||||
|
||||
PORT=3000
|
||||
|
||||
+28
-8
@@ -1,17 +1,23 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
#
|
||||
# PayloadCMS production image. Built and run by docker-compose.
|
||||
# We install pnpm globally via npm so we don't depend on corepack's
|
||||
# (sometimes strict) version negotiation.
|
||||
#
|
||||
# We use Next.js `output: 'standalone'` so the runtime stage doesn't have
|
||||
# to ship the entire node_modules tree — Next analyses the code, picks
|
||||
# only the files that are actually required at runtime, and bundles them
|
||||
# under .next/standalone/. This sidesteps the pnpm content-addressable
|
||||
# store / bin-link issues we hit with the workspace install.
|
||||
#
|
||||
# We install pnpm via `npm install -g pnpm@9` instead of corepack so
|
||||
# the version negotiation is unambiguous across Node 20 minor releases.
|
||||
|
||||
FROM node:20-alpine AS base
|
||||
RUN npm install -g pnpm@9
|
||||
WORKDIR /repo
|
||||
|
||||
# ---- deps -----------------------------------------------------------------
|
||||
# Install ALL workspace deps at the root so the `apps/cms` package can
|
||||
# resolve its siblings (@payloadcms/*, next, react, etc.) and the root
|
||||
# tooling (prettier) is also available.
|
||||
# Install ALL workspace deps at the root so apps/cms can resolve its
|
||||
# siblings (@payloadcms/*, next, react, etc.).
|
||||
FROM base AS deps
|
||||
COPY pnpm-workspace.yaml package.json ./
|
||||
COPY apps/cms/package.json ./apps/cms/package.json
|
||||
@@ -29,11 +35,25 @@ FROM deps AS build
|
||||
COPY apps/cms ./apps/cms
|
||||
WORKDIR /repo/apps/cms
|
||||
RUN pnpm run build
|
||||
# Some apps don't ship a `public/` dir; ensure one exists so the
|
||||
# runtime COPY below doesn't fail.
|
||||
RUN mkdir -p /repo/apps/cms/public
|
||||
|
||||
# ---- runtime --------------------------------------------------------------
|
||||
FROM base AS runtime
|
||||
# Compose the self-contained runtime image from the standalone output.
|
||||
# - .next/standalone/ contains the server.js entrypoint and a trimmed
|
||||
# node_modules tree with only the files Next determined are needed.
|
||||
# - .next/static/ is the hashed client-side bundles; standalone
|
||||
# does NOT include it, so we copy it over manually.
|
||||
# - public/ static assets served from the web root (may be
|
||||
# absent; the COPY is guarded).
|
||||
FROM node:20-alpine AS runtime
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
WORKDIR /repo/apps/cms
|
||||
COPY --from=build /repo ./
|
||||
COPY --from=build /repo/apps/cms/.next/standalone ./
|
||||
COPY --from=build /repo/apps/cms/.next/static ./.next/static
|
||||
COPY --from=build /repo/apps/cms/public ./public
|
||||
EXPOSE 3000
|
||||
CMD ["pnpm", "start"]
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { NextConfig } from 'next';
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
reactStrictMode: true,
|
||||
output: 'standalone',
|
||||
experimental: {
|
||||
reactCompiler: false,
|
||||
},
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
node_modules
|
||||
dist
|
||||
.astro
|
||||
.cache
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
*.log
|
||||
@@ -5,7 +5,4 @@ PUBLIC_SITE_URL=https://softvowels.example
|
||||
PUBLIC_PAYLOAD_API=https://cms.softvowels.example
|
||||
|
||||
# Internal Payload base URL used at build time (container-to-container)
|
||||
PAYLOAD_API_INTERNAL=http://cms:3000
|
||||
|
||||
# Token required to call the /__revalidate webhook
|
||||
REVALIDATE_TOKEN=change-me
|
||||
PAYLOAD_API_INTERNAL=http://softvowels-cms:3000
|
||||
|
||||
+11
-9
@@ -1,15 +1,17 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
#
|
||||
# Single-shot build image for the Astro site. The production deployment uses
|
||||
# nginx:1.27-alpine with a bind mount to apps/web/dist (see docker-compose.yml),
|
||||
# so the webhook can rewrite the site without rebuilding any image.
|
||||
# Astro static site production image. Built and run by docker-compose.
|
||||
#
|
||||
# You only need this Dockerfile if you want a self-contained static site
|
||||
# image (e.g. for a registry). For the normal homeserver flow, this image
|
||||
# is never built.
|
||||
# Multi-stage:
|
||||
# deps - installs the workspace (only apps/web and apps/cms are
|
||||
# needed for the web build, but we keep apps/cms/package.json
|
||||
# so the workspace resolves cleanly).
|
||||
# build - runs `astro build` to produce apps/web/dist.
|
||||
# runtime - small nginx:1.27-alpine serving the baked-in dist/ and
|
||||
# the custom nginx-default.conf.
|
||||
#
|
||||
# We install pnpm globally via npm to avoid corepack's strict version
|
||||
# negotiation across Node 20 minor versions.
|
||||
# We install pnpm via `npm install -g pnpm@9` instead of corepack so
|
||||
# the version negotiation is unambiguous across Node 20 minor releases.
|
||||
|
||||
FROM node:20-alpine AS base
|
||||
RUN npm install -g pnpm@9
|
||||
@@ -30,7 +32,7 @@ RUN if [ -f pnpm-lock.yaml ]; then \
|
||||
FROM deps AS build
|
||||
ENV PUBLIC_PAYLOAD_API=https://cms.softvowels.example
|
||||
ENV PUBLIC_SITE_URL=https://softvowels.example
|
||||
ENV PAYLOAD_API_INTERNAL=http://cms:3000
|
||||
ENV PAYLOAD_API_INTERNAL=http://softvowels-cms:3000
|
||||
COPY apps/web ./apps/web
|
||||
WORKDIR /repo/apps/web
|
||||
RUN pnpm run build
|
||||
|
||||
@@ -27,13 +27,13 @@ const {
|
||||
const base =
|
||||
'inline-flex items-center justify-center gap-2 font-label-md rounded-md transition-all duration-200 select-none disabled:opacity-50 disabled:cursor-not-allowed active:scale-[0.98]';
|
||||
|
||||
const sizes: Record = {
|
||||
const sizes: Record<Size, string> = {
|
||||
sm: 'h-9 px-4 text-[13px]',
|
||||
md: 'h-10 px-5 text-sm',
|
||||
lg: 'h-12 px-7 text-label-md',
|
||||
};
|
||||
|
||||
const variants: Record = {
|
||||
const variants: Record<Variant, string> = {
|
||||
primary: 'bg-primary text-white hover:brightness-110',
|
||||
secondary: 'bg-white text-on-surface border border-border-subtle hover:border-primary',
|
||||
ghost: 'text-primary hover:bg-primary/5',
|
||||
|
||||
@@ -17,11 +17,11 @@ const {
|
||||
ariaLabel,
|
||||
} = Astro.props;
|
||||
|
||||
const surfaces: Record = {
|
||||
const surfaces: Record<NonNullable<Props['variant']>, string> = {
|
||||
raised: 'bg-surface-raised',
|
||||
flat: 'bg-surface-container',
|
||||
};
|
||||
const pads: Record = {
|
||||
const pads: Record<NonNullable<Props['padding']>, string> = {
|
||||
none: '',
|
||||
sm: 'p-4',
|
||||
md: 'p-6',
|
||||
|
||||
@@ -11,7 +11,7 @@ interface Props {
|
||||
const { variant = 'solid', href, class: className = '', ariaLabel } = Astro.props;
|
||||
const base =
|
||||
'inline-flex items-center gap-1.5 rounded-full font-label-md tracking-wider uppercase text-[11px] px-2.5 py-1 transition-colors duration-200';
|
||||
const variants: Record = {
|
||||
const variants: Record<Variant, string> = {
|
||||
solid: 'bg-primary text-white',
|
||||
outline: 'border border-primary/40 text-primary',
|
||||
soft: 'bg-primary/10 text-primary',
|
||||
|
||||
@@ -10,7 +10,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const { name, size = 'md', class: className = '', filled = false, ariaLabel } = Astro.props;
|
||||
const sizes: Record = {
|
||||
const sizes: Record<NonNullable<Props['size']>, string> = {
|
||||
sm: 'text-[18px]',
|
||||
md: 'text-[20px]',
|
||||
lg: 'text-[24px]',
|
||||
|
||||
Reference in New Issue
Block a user