mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-07-14 18:15:56 -04:00
Introduce DATA_DIR env var for consistent data path configuration
Replace separate DATABASE_URL and IMAGE_CACHE_DIR env vars with a single DATA_DIR root (default: ./data, Docker: /data). DATABASE_URL and CACHE_DIR are derived from it but can still be overridden individually. Also: - Pin pnpm to @10 for reproducible Docker builds - Add --link to COPY instructions for better BuildKit cache reuse - Add syntax directive for BuildKit features - Simplify Dockerfile mkdir to just /data (ensureImageDirs handles subdirs) - Remove redundant DATABASE_URL from docker-compose.yml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-6
@@ -1,5 +1,6 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node:24-alpine AS base
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
RUN corepack enable && corepack prepare pnpm@10 --activate
|
||||
|
||||
# --- Dependencies ---
|
||||
FROM base AS deps
|
||||
@@ -25,16 +26,17 @@ WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
ENV PORT=3000
|
||||
ENV DATA_DIR=/data
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs \
|
||||
&& adduser --system --uid 1001 nextjs \
|
||||
&& mkdir -p /data/images/posters /data/images/backdrops /data/images/stills /data/images/logos \
|
||||
&& mkdir -p /data \
|
||||
&& chown -R nextjs:nodejs /data
|
||||
|
||||
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/static ./.next/static
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/drizzle ./drizzle
|
||||
COPY --from=builder --link --chown=nextjs:nodejs /app/public ./public
|
||||
COPY --from=builder --link --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --link --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
COPY --from=builder --link --chown=nextjs:nodejs /app/drizzle ./drizzle
|
||||
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
|
||||
Reference in New Issue
Block a user