66 lines
2.0 KiB
Docker
66 lines
2.0 KiB
Docker
FROM ubuntu:22.04
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive
|
||
|
||
# ============================================================
|
||
# 基础工具
|
||
# SSH Server 安装和配置
|
||
# ============================================================
|
||
RUN apt-get update && apt-get install -y \
|
||
python3 \
|
||
python3-pip \
|
||
python3-venv \
|
||
git \
|
||
wget \
|
||
curl \
|
||
vim \
|
||
sshpass \
|
||
i2c-tools \
|
||
software-properties-common \
|
||
gnupg2 \
|
||
lsb-release \
|
||
openssh-server \
|
||
locales \
|
||
&& mkdir -p /var/run/sshd \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 配置中文 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
|
||
|
||
# SSH 安全配置
|
||
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
|
||
&& sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config \
|
||
&& echo "MaxAuthTries 3" >> /etc/ssh/sshd_config \
|
||
&& echo "MaxStartups 3:50:10" >> /etc/ssh/sshd_config \
|
||
&& echo "LoginGraceTime 30" >> /etc/ssh/sshd_config \
|
||
&& echo "ClientAliveInterval 60" >> /etc/ssh/sshd_config \
|
||
&& echo "ClientAliveCountMax 3" >> /etc/ssh/sshd_config
|
||
|
||
# 生成 SSH Host Key(容器首次启动时会自动生成,这里预生成加速启动)
|
||
RUN ssh-keygen -A
|
||
|
||
# 设置 root 密码
|
||
RUN echo 'root:root' | chpasswd
|
||
|
||
# ============================================================
|
||
# BPU Model Perf 工具
|
||
# ============================================================
|
||
|
||
# 拷贝 hrt_model_exec(从宿主机板子上的路径)
|
||
COPY hrt_model_exec /usr/local/bin/hrt_model_exec
|
||
RUN chmod +x /usr/local/bin/hrt_model_exec
|
||
|
||
# 拷贝 perf 脚本和 entrypoint
|
||
COPY workspace/perf.py /workspace/perf/perf.py
|
||
COPY workspace/entrypoint.sh /workspace/perf/entrypoint.sh
|
||
RUN chmod +x /workspace/perf/entrypoint.sh
|
||
|
||
# 工作目录和挂载点
|
||
RUN mkdir -p /workspace/input /workspace/output
|
||
|
||
WORKDIR /workspace/perf
|
||
|
||
ENTRYPOINT ["/workspace/perf/entrypoint.sh"]
|