Files
LingvAI/Dockerfile
Malin e034771087 fix: handle EACCES on data/settings.json in Docker containers
- settings-store: auto-detect writable path at startup — tries
  <cwd>/data/settings.json first, falls back to /tmp/lingvai-settings.json
  if the directory is not writable. Logs a warning when fallback is used.
  Also supports SETTINGS_PATH env var for explicit override.

- Dockerfile: switch from yarn to npm, explicitly create /app/data with
  chown nextjs:nodejs so the directory is writable at runtime without
  needing a privileged volume mount.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 08:23:29 +01:00

36 lines
1020 B
Docker

# https://nextjs.org/docs/deployment#docker-image
FROM node:lts-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install --legacy-peer-deps
FROM node:lts-alpine AS builder
RUN apk add --no-cache curl
WORKDIR /app
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001
COPY --chown=nextjs:nodejs . .
COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
# Ensure the data directory exists and is writable by the nextjs user
RUN mkdir -p /app/data && chown -R nextjs:nodejs /app/data && chmod 755 /app/data
USER nextjs
EXPOSE 3000
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
HEALTHCHECK --interval=1m --timeout=3s CMD curl -f http://localhost:3000/ || exit 1
CMD NEXT_PUBLIC_SITE_DOMAIN=$site_domain \
NEXT_PUBLIC_FORCE_DEFAULT_THEME=$force_default_theme \
NEXT_PUBLIC_DEFAULT_SOURCE_LANG=$default_source_lang \
NEXT_PUBLIC_DEFAULT_TARGET_LANG=$default_target_lang \
npm run build && npm start