v0.5.2 — Fix Docker deploy on NAS (glibc base, openssl, root, full deps)

The NAS container was crash-looping: npx pulled Prisma 7.8.0 (which rejects
url in the datasource), and the alpine + non-root + standalone setup couldn't
detect openssl or write the migration engine. Switch to the FMB-proven runtime
(node:20-bookworm-slim + openssl, run as root, full node_modules, next start)
so the local pinned Prisma 5.22 CLI runs and migrations apply cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 21:36:30 -05:00
parent 1ebfb06e68
commit 6603717cbb
5 changed files with 44 additions and 25 deletions

View File

@@ -1,33 +1,47 @@
FROM node:20-alpine AS deps # syntax=docker/dockerfile:1.7
# ---- deps ----
FROM node:20-bookworm-slim AS deps
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json ./ RUN apt-get update && apt-get install -y --no-install-recommends \
openssl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json* ./
COPY prisma ./prisma
RUN npm ci RUN npm ci
FROM node:20-alpine AS builder # ---- build ----
FROM node:20-bookworm-slim AS build
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
openssl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .
RUN npx prisma generate RUN npx prisma generate
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build RUN npm run build
FROM node:20-alpine AS runner # ---- runtime ----
FROM node:20-bookworm-slim AS runtime
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
openssl ca-certificates tini tzdata \
&& rm -rf /var/lib/apt/lists/*
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=3000
ENV TZ=America/Chicago
RUN addgroup -S moonbase && adduser -S moonbase -G moonbase COPY --from=build /app/package.json /app/package-lock.json* ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/.next ./.next
COPY --from=build /app/public ./public
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/next.config.mjs ./
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
COPY --from=builder /app/node_modules/.bin/prisma ./node_modules/.bin/prisma
COPY docker-entrypoint.sh ./
RUN chmod +x docker-entrypoint.sh
USER moonbase
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/docker-entrypoint.sh"]
ENTRYPOINT ["./docker-entrypoint.sh"] CMD ["npm", "run", "start"]

View File

@@ -1,8 +1,7 @@
#!/bin/sh #!/bin/sh
set -e set -e
echo "Running Prisma migrations..." echo "[moonbase] running prisma migrate deploy..."
./node_modules/.bin/prisma migrate deploy npx prisma migrate deploy
echo "Starting Moon Base..." exec "$@"
exec node server.js

View File

@@ -1,6 +1,5 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
output: "standalone",
images: { images: {
remotePatterns: [{ protocol: "https", hostname: "**" }], remotePatterns: [{ protocol: "https", hostname: "**" }],
}, },

View File

@@ -8,6 +8,13 @@ export type ChangelogEntry = {
}; };
export const CHANGELOG: ChangelogEntry[] = [ export const CHANGELOG: ChangelogEntry[] = [
{
version: "0.5.2",
date: "2026-06-15",
changes: [
"Fixed the app failing to start on the home server — it now launches and runs reliably.",
],
},
{ {
version: "0.5.1", version: "0.5.1",
date: "2026-06-15", date: "2026-06-15",

View File

@@ -1,2 +1,2 @@
// Bump on every user-visible release. Changelog entries live in `src/lib/changelog.ts`. // Bump on every user-visible release. Changelog entries live in `src/lib/changelog.ts`.
export const APP_VERSION = "0.5.1"; export const APP_VERSION = "0.5.2";