stl-storage/Dockerfile
kris 3dff6b00d4 Initial commit: STL Storage Application
- Complete web-based STL file storage and 3D viewer
- Express.js backend with SQLite database
- Interactive Three.js 3D viewer with orbit controls
- File upload with drag-and-drop support
- Security features: rate limiting, input validation, helmet
- Container deployment with Docker/Podman
- Production-ready configuration management
- Comprehensive logging and monitoring

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 16:18:58 +00:00

35 lines
912 B
Docker

FROM node:18-alpine
# Set working directory
WORKDIR /app
# Create app user for security
RUN addgroup -g 1001 -S nodejs && \
adduser -S stlapp -u 1001
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production && npm cache clean --force
# Copy application code
COPY . .
# Create necessary directories and set permissions
RUN mkdir -p uploads/stl uploads/thumbnails logs data config && \
chown -R stlapp:nodejs /app && \
chmod -R 755 /app
# Switch to non-root user
USER stlapp
# Expose port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/api/files', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"
# Start the application
CMD ["sh", "-c", "test -f stl_storage.db || node init-db.js; node server.js"]