CodeQL Advanced / Analyze (actions) (push) Canceled after 0s
CodeQL Advanced / Analyze (java-kotlin) (push) Canceled after 0s
CodeQL Advanced / Analyze (javascript-typescript) (push) Canceled after 0s
CodeQL Advanced / Analyze (python) (push) Canceled after 0s
Docker Image Build & Push / manifest (push) Canceled after 0s
Docker Image Build & Push / build-and-push-arm (push) Canceled after 0s
Docker Image Build & Push / build-and-push-amd (push) Canceled after 0s
Docker Image Build & Push / manifest (push) Canceled after 0s
Docker Image Build & Push / build-and-push-arm (push) Canceled after 0s
Docker Image Build & Push / build-and-push-amd (push) Canceled after 0s
Python Backend Docker Image CI / Build and Push Backend Python Docker Image (push) Canceled after 0s
Runtime Docker Image CI / Build and Push Runtime Docker Image (push) Canceled after 0s
- runtime: install zh_core_web_sm from vendored wheel (reused from runtime-ray)
instead of 'python -m spacy download' (GitHub 403 on server)
- runtime / runtime-ray / backend-python: replace nltk.download (GitHub +
nltk_data.nltk.org unreachable from server) with vendored zips extracted
to /usr/local/nltk_data/packages/{tokenizers,taggers}
82 lines
3.4 KiB
Docker
82 lines
3.4 KiB
Docker
# syntax=docker/dockerfile:1
|
|
FROM maven:3-eclipse-temurin-8 AS datax-builder
|
|
|
|
# 仅安装必要的 git
|
|
RUN apt-get update && \
|
|
apt-get install -y git && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# 🟢 修改 1:恢复 git clone 下载完整源码,本地先git clone DataX
|
|
# RUN git clone https://github.com/alibaba/DataX.git
|
|
COPY DataX/ /DataX/
|
|
|
|
# 🟢 修改 2:注释掉 COPY,因为它覆盖了完整代码且不完整
|
|
COPY runtime/datax/ DataX/
|
|
|
|
# 🟢 优化 1:挂载 Maven 缓存 + 执行修复与编译
|
|
# 注意:这里恢复了之前讨论的 MySQL 驱动修复(sed),因为源码完整了,路径也就对了
|
|
RUN --mount=type=cache,target=/root/.m2 \
|
|
cd DataX && \
|
|
sed -i "s/com.mysql.jdbc.Driver/com.mysql.cj.jdbc.Driver/g" \
|
|
plugin-rdbms-util/src/main/java/com/alibaba/datax/plugin/rdbms/util/DataBaseType.java && \
|
|
mvn -U clean package assembly:assembly -Dmaven.test.skip=true
|
|
|
|
FROM python:3.12-slim
|
|
|
|
# 🟢 优化 2:挂载 APT 缓存,加速 apt-get update
|
|
RUN --mount=type=cache,target=/var/cache/apt \
|
|
--mount=type=cache,target=/var/lib/apt \
|
|
apt-get update && \
|
|
apt-get install -y --no-install-recommends vim openjdk-21-jre nfs-common glusterfs-client rsync dos2unix && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
POETRY_VERSION=2.2.1 \
|
|
POETRY_NO_INTERACTION=1 \
|
|
POETRY_VIRTUALENVS_CREATE=false \
|
|
POETRY_CACHE_DIR=/tmp/poetry_cache
|
|
|
|
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk
|
|
ENV PATH="/root/.local/bin:$JAVA_HOME/bin:$PATH"
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装 Poetry
|
|
RUN pip install --upgrade --root-user-action=ignore pip \
|
|
&& pip install --root-user-action=ignore pipx \
|
|
&& pipx install "poetry==$POETRY_VERSION"
|
|
|
|
# 复制依赖文件
|
|
COPY runtime/deepdata-python/pyproject.toml runtime/deepdata-python/poetry.lock* /app/
|
|
|
|
# 🟢 优化 3:挂载 Poetry 缓存,避免重复下载 Python 包
|
|
RUN --mount=type=cache,target=$POETRY_CACHE_DIR \
|
|
poetry install --no-root --only main
|
|
|
|
# 🆕 新增:安装 Ray SDK (用于提交任务到 Ray 集群)
|
|
# 注意:使用 [default] 确保包含 job submission client
|
|
RUN pip install "ray[default]>=2.9.0"
|
|
|
|
# 下载 NLTK 数据(离线:使用仓库内 vendor 的数据包,服务器无法访问 GitHub)
|
|
COPY scripts/images/common/nltk-data/ /tmp/nltk-data/
|
|
RUN python -c "import zipfile, os; os.makedirs('/usr/local/nltk_data/packages/tokenizers', exist_ok=True); os.makedirs('/usr/local/nltk_data/packages/taggers', exist_ok=True); zipfile.ZipFile('/tmp/nltk-data/punkt_tab.zip').extractall('/usr/local/nltk_data/packages/tokenizers'); zipfile.ZipFile('/tmp/nltk-data/averaged_perceptron_tagger_eng.zip').extractall('/usr/local/nltk_data/packages/taggers')"
|
|
ENV NLTK_DATA=/usr/local/nltk_data
|
|
|
|
# 复制应用代码
|
|
COPY runtime/deepdata-python /app
|
|
COPY runtime/ops/examples/test_operator/test_operator.tar /app/test_operator.tar
|
|
|
|
COPY --from=datax-builder /DataX/target/datax/datax /opt/datax
|
|
RUN cp /opt/datax/plugin/reader/mysqlreader/libs/mysql* /opt/datax/plugin/reader/starrocksreader/libs/
|
|
|
|
COPY runtime/deepdata-python/deploy/docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh \
|
|
&& dos2unix /docker-entrypoint.sh || true \
|
|
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|
|
|
# Expose the application port
|
|
EXPOSE 18000
|
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|