回复
BearPi-HM-Micro 鸿蒙开发环境一键启动 原创
Thne
发布于 2021-12-12 20:22
浏览
0收藏
介绍
基于BearPi-Naro 鸿蒙开发环境一键启动,随着BearPi社区发布了新品Micro,咱们的教程也更新一下。整体来说,构建方式和之前还是有很大区别的,官方的教程一如既往的好用,咱们也来个Docker版本。
食用方式一、一键启动
docker run -it --name bearpi_micro -v ~/code:/code thne/bearpi_micro:v1
食用方式二、手动构建
1. 拉取本代码仓
git clone https://gitee.com/451101751/bearpi_micro_docker.git
2. 构建镜像
docker build -t bearpi_micro -f Dockerfile . --no-cache
3. 启动镜像
docker run -it --name bearpi_micro -v ~/code:/code bearpi_micro:v1 # ~/code:/code 表示会把容器中的/code目录映射到 本机~/code 目录
4. 获取源码和编译方式请参考官方教程
附
- Dockerfile
- build.sh
Dockerfile
FROM ubuntu:20.04
WORKDIR /root
RUN mkdir ~/tools
COPY mkimage.stm32 ./tools/
RUN chmod 777 ~/tools/mkimage.stm32
COPY build.sh ./
COPY requirements.txt ./
COPY pip.conf /etc/pip.conf
RUN ln -fs /bin/bash /bin/sh && chmod -x ~/build.sh
ENV TZ Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN ["/bin/bash", "-c", "source build.sh"]
RUN mkdir /code
WORKDIR /code
VOLUME /code
build.sh
#!/bin/bash
cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
apt-get update
apt-get install -y build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi cpio device-tree-compiler net-tools openssh-server git vim openjdk-11-jre-headless
apt-get -y install python3.8
apt-get -y install python3-pip
rm /usr/bin/python
ln -s python3.8 /usr/bin/python
pip3 install -r requirements.txt
cat >>~/.bashrc<<EOF
export PATH=~/.local/bin:$PATH
export PATH=~/tools:$PATH
EOF
source ~/.bashrc
©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
分类
标签
已于2021-12-13 19:30:56修改
赞
1
收藏
回复
相关推荐