58 lines
1.7 KiB
Docker
58 lines
1.7 KiB
Docker
FROM ubuntu:22.04
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive
|
||
|
||
# ============================================================
|
||
# 基础工具 + 编译工具
|
||
# ============================================================
|
||
RUN apt-get update && apt-get install -y \
|
||
python3 \
|
||
python3-pip \
|
||
build-essential \
|
||
gcc \
|
||
g++ \
|
||
make \
|
||
locales \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 安装 Python 依赖
|
||
RUN pip3 install --no-cache-dir psutil
|
||
|
||
# 配置中文 locale(防止终端中文乱码)
|
||
RUN locale-gen zh_CN.UTF-8 && update-locale LANG=zh_CN.UTF-8
|
||
ENV LANG=zh_CN.UTF-8
|
||
ENV LC_ALL=zh_CN.UTF-8
|
||
|
||
# ============================================================
|
||
# CoreMark-PRO 编译
|
||
# ============================================================
|
||
|
||
# 拷贝 CoreMark-PRO 源代码
|
||
COPY coremark-pro /workspace/coremark-pro-src
|
||
|
||
# 编译 CoreMark-PRO
|
||
WORKDIR /workspace/coremark-pro-src
|
||
RUN make TARGET=linux64 clean 2>/dev/null || true && \
|
||
make TARGET=linux64 build
|
||
|
||
# 创建运行目录结构
|
||
RUN mkdir -p /workspace/coremark-pro/builds/linux64/gcc64/bin && \
|
||
cp /workspace/coremark-pro-src/builds/linux64/gcc64/bin/*.exe /workspace/coremark-pro/builds/linux64/gcc64/bin/ && \
|
||
rm -rf /workspace/coremark-pro-src
|
||
|
||
# ============================================================
|
||
# 设置运行环境
|
||
# ============================================================
|
||
|
||
# 拷贝 benchmark 脚本和 entrypoint
|
||
COPY workspace/coremark_perf.py /workspace/coremark/coremark_perf.py
|
||
COPY workspace/entrypoint.sh /workspace/coremark/entrypoint.sh
|
||
RUN chmod +x /workspace/coremark/entrypoint.sh
|
||
|
||
# 工作目录和挂载点
|
||
RUN mkdir -p /workspace/input /workspace/output
|
||
|
||
WORKDIR /workspace/coremark
|
||
|
||
ENTRYPOINT ["/workspace/coremark/entrypoint.sh"]
|