Dockerfile.localā¢1.21 kB
# MySQL MCP WebUI - Local Build Dockerfile
# Use this when you've already built the project locally
# Run: npm run build && docker build -f Dockerfile.local -t mysql-mcp-webui .
FROM node:20-alpine
WORKDIR /app
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Copy package files
COPY package*.json ./
COPY client/package*.json ./client/
COPY server/package*.json ./server/
# Install production dependencies only
RUN npm ci --omit=dev && \
npm cache clean --force
# Copy pre-built artifacts (must exist locally)
COPY --chown=nodejs:nodejs server/dist ./server/dist
COPY --chown=nodejs:nodejs server/public ./server/public
# Create data directory for SQLite database
RUN mkdir -p /app/data && \
chown -R nodejs:nodejs /app/data
# Switch to non-root user
USER nodejs
# Expose port
EXPOSE 9274
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD node -e "require('http').get('http://localhost:9274/api/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"
# Set environment variables
ENV NODE_ENV=production \
TRANSPORT=http \
HTTP_PORT=9274
# Start the server
CMD ["node", "server/dist/index.js"]