fix: Run container as root to avoid volume permission issues #17

Merged
darroyo merged 1 commits from develop into main 2026-03-24 16:04:05 +00:00
2 changed files with 1 additions and 8 deletions
Showing only changes of commit 66db3de33d - Show all commits

View File

@@ -39,9 +39,6 @@ ENV NODE_ENV=production
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
openssl \ openssl \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& groupadd --system --gid 1001 nodejs \
&& useradd --system --uid 1001 nextjs \
&& mkdir -p /home/nextjs && chown nextjs:nextjs /home/nextjs \
&& apt-get clean && rm -rf /var/lib/apt/lists/* && apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
@@ -56,15 +53,11 @@ COPY --from=builder /app/prisma/schema.prisma /app/schema.prisma
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Create data directory with proper permissions
RUN mkdir -p /app/data && chown -R nextjs:nextjs /app
EXPOSE 3000 EXPOSE 3000
ENV PORT=3000 ENV PORT=3000
ENV HOSTNAME="0.0.0.0" ENV HOSTNAME="0.0.0.0"
ENV DATABASE_URL="file:./data/dev.db" ENV DATABASE_URL="file:./data/dev.db"
ENV HOME=/home/nextjs
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["node", "server.js"] CMD ["node", "server.js"]

View File

@@ -11,4 +11,4 @@ mkdir -p /app/data
./node_modules/prisma/build/index.js db push --skip-generate ./node_modules/prisma/build/index.js db push --skip-generate
echo "Starting application..." echo "Starting application..."
exec su nextjs -c "cd /app && node server.js" exec "$@"