Files
wordcloud/backend/Dockerfile
T
2026-07-04 02:40:45 +08:00

37 lines
1.0 KiB
Docker

# syntax=docker/dockerfile:1
FROM python:3.10-slim
# Install build tools needed for the C++ extension plus curl for healthchecks
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
g++ \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy and install Python dependencies first (better layer caching)
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend source code and the C++ extension source
COPY service ./service
COPY core ./core
COPY EfficientWordCloud ./EfficientWordCloud
COPY assets ./assets
COPY start-dev.sh ./
COPY wordcloud_generate_hybrid.py ./
# Build the C++ extension in-place
RUN cd EfficientWordCloud && python setup.py build_ext --inplace
# Runtime data directories (will be mounted as volumes)
RUN mkdir -p service_workspace service_assets service_projects service_design_templates service_fonts
EXPOSE 8000
ENV PYTHONPATH=/app/EfficientWordCloud
CMD ["uvicorn", "service.app:app", "--host", "0.0.0.0", "--port", "8000"]