52 lines
1.3 KiB
Docker
52 lines
1.3 KiB
Docker
# Dockerfile for selfhosted-supabase-mcp HTTP mode
|
|
# Multi-stage build using Bun runtime for self-hosted Supabase
|
|
|
|
FROM oven/bun:1.1-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files from submodule
|
|
COPY selfhosted-supabase-mcp/package.json selfhosted-supabase-mcp/bun.lock* ./
|
|
|
|
# Install dependencies
|
|
RUN bun install --frozen-lockfile || bun install
|
|
|
|
# Copy source code
|
|
COPY selfhosted-supabase-mcp/src ./src
|
|
COPY selfhosted-supabase-mcp/tsconfig.json ./
|
|
|
|
# Build the application
|
|
RUN bun build src/index.ts --outdir dist --target bun
|
|
|
|
# Production stage
|
|
FROM oven/bun:1.1-alpine AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
# Create non-root user for security
|
|
RUN addgroup --system --gid 1001 mcp && \
|
|
adduser --system --uid 1001 --ingroup mcp mcp
|
|
|
|
# Copy built application from builder
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/package.json ./
|
|
|
|
# Set ownership
|
|
RUN chown -R mcp:mcp /app
|
|
|
|
USER mcp
|
|
|
|
# Default environment variables
|
|
ENV NODE_ENV=production
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:3100/health || exit 1
|
|
|
|
# Expose HTTP port
|
|
EXPOSE 3100
|
|
|
|
# Start the MCP server in HTTP mode
|
|
CMD ["bun", "run", "dist/index.js"]
|