FROM node:18-alpine WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm install --production # Copy application code COPY server.js ./ COPY config.js ./ COPY migrations ./migrations # Copy public directory explicitly COPY public/ ./public/ # Create non-root user and fix permissions RUN addgroup -g 1001 -S nodejs && \ adduser -S nodejs -u 1001 && \ chown -R nodejs:nodejs /app && \ ls -la /app && \ ls -la /app/public USER nodejs EXPOSE 3000 CMD ["node", "server.js"]