Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cd6651cc43 | |||
| 855390a27b | |||
| ea8bd46973 | |||
| ff269b1f84 |
@@ -41,8 +41,15 @@ COPY . .
|
|||||||
# Build application
|
# Build application
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
|
# Transpile migrations to JS for production compatibility (ESM requires extensions)
|
||||||
|
RUN mkdir -p dist-migrations && \
|
||||||
|
npx tsc migrations/*.ts --outDir dist-migrations --module esnext --target esnext --moduleResolution node --esModuleInterop --skipLibCheck || true && \
|
||||||
|
cp migrations/*.json dist-migrations/ 2>/dev/null || true && \
|
||||||
|
sed -i -E 's/(from|import) "\.\/([^"]*)"/\1 ".\/\2.js"/g' dist-migrations/index.js
|
||||||
|
|
||||||
# Stage 2: Runner
|
# Stage 2: Runner
|
||||||
FROM node:20-alpine AS runner
|
FROM node:20-alpine AS runner
|
||||||
|
# ... [skipping middle part as I'm replacing lines 45-64 in a single block] ...
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install curl for health checks
|
# Install curl for health checks
|
||||||
@@ -61,6 +68,7 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
|||||||
# Copy standalone output and static files
|
# Copy standalone output and static files
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/dist-migrations ./migrations
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/cache ./.next/cache
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/cache ./.next/cache
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import sharp from "sharp";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import { payloadBlocks } from "./blocks/allBlocks";
|
import { payloadBlocks } from "./blocks/allBlocks";
|
||||||
import { migrations } from "../../migrations/index";
|
|
||||||
|
|
||||||
import { Users } from "./collections/Users";
|
import { Users } from "./collections/Users";
|
||||||
import { Media } from "./collections/Media";
|
import { Media } from "./collections/Media";
|
||||||
@@ -41,7 +40,6 @@ export default buildConfig({
|
|||||||
outputFile: path.resolve(dirname, "payload-types.ts"),
|
outputFile: path.resolve(dirname, "payload-types.ts"),
|
||||||
},
|
},
|
||||||
db: postgresAdapter({
|
db: postgresAdapter({
|
||||||
migrations,
|
|
||||||
pool: {
|
pool: {
|
||||||
connectionString:
|
connectionString:
|
||||||
process.env.DATABASE_URI ||
|
process.env.DATABASE_URI ||
|
||||||
|
|||||||
Reference in New Issue
Block a user