Files
DataMate/scripts/images/datamate-python/Dockerfile
Jason Wang b5fe787c20 feat: Labeling Frontend adaptations + Backend build and deploy + Logging improvement (#55)
* feat: Front-end data annotation page adaptation to the backend API.

* feat: Implement labeling configuration editor and enhance annotation task creation form

* feat: add python backend build and deployment; add backend configuration for Label Studio integration and improve logging setup

* refactor: remove duplicate log configuration
2025-11-05 01:55:53 +08:00

36 lines
1.4 KiB
Docker

FROM python:3.11-slim
# Single-stage image with build cache optimization using BuildKit cache mounts.
# Note: to use the cache mount syntax you must build with BuildKit enabled:
# DOCKER_BUILDKIT=1 docker build . -f scripts/images/datamate-python/Dockerfile -t datamate-backend-python
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# Install build deps needed to compile some wheels. We'll remove them afterwards to keep the
# final image small. Use --no-install-recommends to minimize installed packages.
# RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# build-essential \
# gcc \
# && apt-get purge -y --auto-remove build-essential gcc \
# && rm -rf /var/lib/apt/lists/*
# Copy requirements first (leverages layer caching when requirements don't change)
COPY runtime/datamate-python /app
# Install Python deps. Use BuildKit cache mount for pip cache to speed subsequent builds.
# The --mount=type=cache requires BuildKit. This keeps downloaded wheels/cache out of the final image.
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --upgrade --root-user-action=ignore pip setuptools wheel \
&& pip install --root-user-action=ignore -r /app/requirements.txt
COPY runtime/datamate-python/deploy/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh || true
# Expose the application port
EXPOSE 18000
ENTRYPOINT ["/docker-entrypoint.sh"]