# Dockerfile using npm package tarball from volume
# Run 'npm pack' before building to create the tarball
# Optimized for smaller image size

FROM node:22-bookworm-slim

WORKDIR /app

# Runtime environment
ENV NODE_ENV=production \
    MCP_HTTP_PORT=3000 \
    MCP_HTTP_HOST=0.0.0.0

# Extract and install package with production dependencies only
RUN --mount=type=bind,source=docker/packages,target=/packages \
    tar -xzf /packages/*.tgz --strip-components=1 && \
    npm install --omit=dev --production && \
    npm cache clean --force

# Create directories for service keys and sessions
RUN mkdir -p /app/service-keys /app/sessions

# Start server with stdio transport (for MCP inspection and glama.ai)
# Without connection parameters, runs in inspection-only mode
CMD ["node", "./bin/mcp-abap-adt.js", "--transport", "stdio"]
