Add HTTP interface, templates, generate_from_template, unified Dockerfile
Continuous Integration / Test Suite (macos-latest, nightly) (push) Has been cancelled
Continuous Integration / Test Suite (macos-latest, stable) (push) Has been cancelled
Continuous Integration / Test Suite (ubuntu-latest, 1.70.0) (push) Has been cancelled
Continuous Integration / Test Suite (ubuntu-latest, beta) (push) Has been cancelled
Continuous Integration / Test Suite (ubuntu-latest, nightly) (push) Has been cancelled
Continuous Integration / Test Suite (ubuntu-latest, stable) (push) Has been cancelled
Continuous Integration / Test Suite (windows-latest, stable) (push) Has been cancelled
Continuous Integration / Security Audit (push) Has been cancelled
Continuous Integration / Code Coverage (push) Has been cancelled
Continuous Integration / Performance Benchmarks (push) Has been cancelled
Continuous Integration / Memory Safety Check (push) Has been cancelled
Continuous Integration / Docker Build Test (push) Has been cancelled
Continuous Integration / Release Readiness (push) Has been cancelled
Continuous Integration / Integration Tests (push) Has been cancelled
Continuous Integration / Stress Testing (push) Has been cancelled
Continuous Integration / Notify Results (push) Has been cancelled
Continuous Integration / Test Suite (macos-latest, nightly) (push) Has been cancelled
Continuous Integration / Test Suite (macos-latest, stable) (push) Has been cancelled
Continuous Integration / Test Suite (ubuntu-latest, 1.70.0) (push) Has been cancelled
Continuous Integration / Test Suite (ubuntu-latest, beta) (push) Has been cancelled
Continuous Integration / Test Suite (ubuntu-latest, nightly) (push) Has been cancelled
Continuous Integration / Test Suite (ubuntu-latest, stable) (push) Has been cancelled
Continuous Integration / Test Suite (windows-latest, stable) (push) Has been cancelled
Continuous Integration / Security Audit (push) Has been cancelled
Continuous Integration / Code Coverage (push) Has been cancelled
Continuous Integration / Performance Benchmarks (push) Has been cancelled
Continuous Integration / Memory Safety Check (push) Has been cancelled
Continuous Integration / Docker Build Test (push) Has been cancelled
Continuous Integration / Release Readiness (push) Has been cancelled
Continuous Integration / Integration Tests (push) Has been cancelled
Continuous Integration / Stress Testing (push) Has been cancelled
Continuous Integration / Notify Results (push) Has been cancelled
This commit is contained in:
+50
-34
@@ -1,8 +1,17 @@
|
||||
# Multi-stage Docker build for docx-mcp
|
||||
FROM rust:1.75-slim as builder
|
||||
# Unified Dockerfile for docx-mcp
|
||||
# Features:
|
||||
# - HTTP mode (HTML interface) + stdio mode
|
||||
# - LibreOffice for high-fidelity PDF conversion
|
||||
# - Templates directory support
|
||||
# - Sandboxed, non-root, read-only filesystem where possible
|
||||
|
||||
# Install system dependencies for building
|
||||
RUN apt-get update && apt-get install -y \
|
||||
# ============================================================
|
||||
# Build Stage
|
||||
# ============================================================
|
||||
FROM rust:1.80-slim AS builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
libfontconfig1-dev \
|
||||
@@ -12,26 +21,26 @@ RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy manifests
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY build.rs ./
|
||||
|
||||
# Copy source code
|
||||
# Copy manifests and source
|
||||
COPY Cargo.toml Cargo.lock build.rs ./
|
||||
COPY src/ ./src/
|
||||
COPY benches/ ./benches/
|
||||
COPY tests/ ./tests/
|
||||
COPY assets/ ./assets/
|
||||
|
||||
# Build the application
|
||||
RUN cargo build --release --all-features
|
||||
# Build with all key features enabled:
|
||||
# - runtime-server: stdio MCP transport
|
||||
# - http-server: HTTP + HTML interface
|
||||
# - advanced-docx: advanced document operations
|
||||
RUN cargo build --release --features "runtime-server http-server advanced-docx"
|
||||
|
||||
# Runtime stage
|
||||
FROM debian:bookworm-slim
|
||||
# ============================================================
|
||||
# Runtime Stage
|
||||
# ============================================================
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
# Install runtime dependencies (including LibreOffice for better PDF conversion)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libssl3 \
|
||||
libfontconfig1 \
|
||||
libfreetype6 \
|
||||
@@ -45,33 +54,40 @@ RUN apt-get update && apt-get install -y \
|
||||
# Create non-root user
|
||||
RUN groupadd -r docxmcp && useradd -r -g docxmcp -s /bin/bash -d /app docxmcp
|
||||
|
||||
# Create app directory and set ownership
|
||||
WORKDIR /app
|
||||
RUN chown -R docxmcp:docxmcp /app
|
||||
|
||||
# Copy the built binary from builder stage
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /app/target/release/docx-mcp /usr/local/bin/docx-mcp
|
||||
RUN chmod +x /usr/local/bin/docx-mcp
|
||||
|
||||
# Copy additional files if needed
|
||||
COPY README.md LICENSE ./
|
||||
# Create working directories
|
||||
RUN mkdir -p /tmp/docx-mcp /templates /out && \
|
||||
chown -R docxmcp:docxmcp /tmp/docx-mcp /templates /out
|
||||
|
||||
# Switch to non-root user
|
||||
USER docxmcp
|
||||
|
||||
# Create temp directory for document processing
|
||||
RUN mkdir -p /tmp/docx-mcp && chmod 755 /tmp/docx-mcp
|
||||
# Expose HTTP port (used when running in HTTP mode)
|
||||
EXPOSE 3000
|
||||
|
||||
# Expose default MCP port (though MCP typically uses stdin/stdout)
|
||||
EXPOSE 8080
|
||||
# Health check (checks binary is present and executable)
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD /usr/local/bin/docx-mcp --version
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD /usr/local/bin/docx-mcp --version || exit 1
|
||||
|
||||
# Set environment variables
|
||||
# Default environment:
|
||||
# - HTTP disabled by default (use stdio mode).
|
||||
# - Enable via DOCX_MCP_HTTP=true or --http-mode.
|
||||
ENV RUST_LOG=info
|
||||
ENV DOCX_MCP_TEMP_DIR=/tmp/docx-mcp
|
||||
ENV DOCX_MCP_TEMP=/tmp/docx-mcp
|
||||
ENV DOCX_MCP_HTTP=false
|
||||
ENV DOCX_MCP_HTTP_ADDRESS=0.0.0.0:3000
|
||||
ENV DOCX_MCP_TEMPLATES_DIR=/templates
|
||||
ENV DOCX_MCP_MAX_SIZE=104857600
|
||||
ENV DOCX_MCP_MAX_DOCS=30
|
||||
|
||||
# Default command
|
||||
CMD ["/usr/local/bin/docx-mcp"]
|
||||
ENTRYPOINT ["/usr/local/bin/docx-mcp"]
|
||||
|
||||
# Default: stdio mode (for MCP clients).
|
||||
# To run in HTTP mode, override CMD or set DOCX_MCP_HTTP=true.
|
||||
CMD []
|
||||
|
||||
Reference in New Issue
Block a user