7bcee648ad
- Create dedicated Dockerfile.backend.dev for development with proper permissions - Set user UID/GID to 1000 (common for development systems) - Create logs and temp directories in Dockerfile before switching user - Use named volumes for logs, temp, and node_modules to maintain permissions - Mount only source files instead of entire backend directory - Remove complex entrypoint script in favor of simple CMD - Add LOG_DIR and TEMP_DIR environment variables This fixes the "Permission denied" errors when creating directories in Docker. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
688 B
Docker
36 lines
688 B
Docker
FROM node:20-alpine
|
|
|
|
# Install MinIO client
|
|
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc && \
|
|
chmod +x mc && \
|
|
mv mc /usr/local/bin/
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install production dependencies
|
|
RUN npm ci --only=production
|
|
|
|
# Copy application files
|
|
COPY . .
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1001 -S nodejs && \
|
|
adduser -S nodejs -u 1001
|
|
|
|
# Create necessary directories with proper permissions
|
|
RUN mkdir -p logs temp && \
|
|
chown -R nodejs:nodejs /app && \
|
|
chmod 755 logs temp
|
|
|
|
# Switch to non-root user
|
|
USER nodejs
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Start the application
|
|
CMD ["node", "src/app.js"] |