Update Dockerfile to run as root user
All checks were successful
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m35s
All checks were successful
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m35s
Remove non-root user creation and USER directive to allow root privileges for custom steps
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -41,12 +41,8 @@ ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV DATABASE_URL="file:./data/dev.db"
|
||||
|
||||
# Create non-root user for security
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
# Create data directory for SQLite
|
||||
RUN mkdir -p /app/data && chown nextjs:nodejs /app/data
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
# Copy necessary files from builder
|
||||
COPY --from=builder /app/public ./public
|
||||
@@ -56,12 +52,6 @@ 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
|
||||
|
||||
# Set correct ownership
|
||||
RUN chown -R nextjs:nodejs /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER nextjs
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
@@ -72,5 +62,5 @@ ENV HOSTNAME="0.0.0.0"
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
|
||||
|
||||
# Start the server
|
||||
# Start the server (running as root)
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
Reference in New Issue
Block a user