1 Star 2 Fork 313

keithyau / build_lite

forked from OpenHarmony / build_lite
暂停
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Dockerfile20.04 5.54 KB
一键复制 编辑 原始数据 按行查看 历史
keithyau 提交于 2020-09-15 11:14 . update path
######################################################################################################
##
#OpenHarmony Compile Steps (For 3516D only)
#0. download OpenHarmony dockerFile to your work directory (suggest Docker for Windows)
#1. ssh-keygen -c xxx@xxx.com and upload id_rsa.pub to gitee
#Assume you know SSH-keygen in any OS
# example: ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
# cat /root/.ssh/id_rsa.pub #Paste key to gitee.com on website
#2. put id_rsa same directory with dockerFile
#3. Run powershell / windows terminal, go to dockerfile Directory with a id_rsa key
# docker build -t openharmony:v0.x --build-arg wifiiot --build-arg gitUSERNAME=xxx --build-arg gitPASSWORD=xxx --build-arg gitUSEREMAIL=xxx@xxx.com .
#4. run the compiled docker image and copy OHOS images
# docker run -ti -d --name openharmony_compiled openharmony:v0.x bash
# docker cp openharmony:/OpenHarmony/out/ipcamera_hi3516dv300/OHOS_Image.bin .
# docker cp openharmony:/OpenHarmony/out/ipcamera_hi3516dv300/rootfs.img .
# docker cp openharmony:/OpenHarmony/out/ipcamera_hi3516dv300/userfs.img .
#5. Get into Docker if you need
# docker attach openharmony_compiled
##################################################################################################
FROM ubuntu:20.04 AS build-env
LABEL version=v0.9
#Set your hardware
ARG HARDWARE=wifiiot
#Get arg and set default value
ARG gitUSERNAME=xxx
ARG gitUSEREMAIL=xxx@163.com
ARG gitUSERPASSEWORD=xxxxx
#Init variables
ENV username=${gitUSERNAME}
ENV useremail=${gitUSEREMAIL}
ENV userpassword=${gitUSERPASSEWORD}
#Prevent interactive
ENV DEBIAN_FRONTEND=noninteractive
# Setting up the build environment
RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \
sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \
apt-get clean -y && \
apt-get -y update && \
#apt-get -y dist-upgrade && \
apt-get remove python* -y && \
apt-get install git curl build-essential libdbus-glib-1-dev libgirepository1.0-dev -y && \
apt-get install zip libncurses5-dev pkg-config -y && \
#20.04 default python3.8
apt-get install python3-pip -y && \
apt-get install scons dosfstools mtools -y
# Setup python
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
#Make sure python install on the right python version path
pip3 install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple && \
pip3 install ninja kconfiglib pycryptodome ecdsa -i https://mirrors.aliyun.com/pypi/simple && \
pip3 install six --upgrade --ignore-installed six -i https://pypi.tuna.tsinghua.edu.cn/simple && \
rm -rf /var/cache/apt/archives
#Fix Dash
RUN rm -rf /bin/sh && \
ln -s /bin/bash /bin/sh
#Setup gn
RUN mkdir /tools && \
cd /tools && \
curl -LO https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar && \
tar xvf /tools/gn.1523.tar && \
chmod a+x /tools/gn && \
mv gn/gn /usr/bin/gn
#Setup LLVM
#ADD ./llvm-linux-9.0.0-34042.tar /tools
RUN cd /tools && \
curl -LO https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar && \
tar xvf /tools/llvm-linux-9.0.0-34042.tar && \
echo "export PATH=/tools/llvm/bin:$PATH" >> /etc/profile
ENV PATH /tools/llvm/bin:$PATH
#Setup hc-gen
RUN cd /tools && \
curl -LO https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar && \
tar xvf /tools/hc-gen-0.65-linux.tar && \
echo "export PATH=/tools/hc-gen:$PATH" >> /etc/profile
ENV PATH /tools/hc-gen:$PATH
#Setup gcc_riscv32
RUN cd /tools && \
curl -LO https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz && \
tar xvf /tools/gcc_riscv32-linux-7.3.0.tar.gz && \
echo "export PATH=/tools/gcc_riscv32/bin:$PATH" >> /etc/profile
ENV PATH /tools/gcc_riscv32/bin:$PATH
#Create work dir
RUN mkdir /OpenHarmony
WORKDIR /OpenHarmony
#Copy your gitee SSH private key into Docker (Assume your public already on gitee)
COPY ./id_rsa /root/.ssh/id_rsa
#Using google version repo
#RUN apt-get install -y repo && \
# sed -i 's/gerrit.googlesource.com/mirrors.tuna.tsinghua.edu.cn\/git/g' /usr/bin/repo
# Gitee Repo tool and download
RUN curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/bin/repo && \
chmod a+x /usr/bin/repo && \
#Make sure requests install at the right location
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
#Download source, update to your info
RUN git config --global user.email "${useremail}" && \
git config --global user.name "${username}" && \
git config --global color.ui false && \
git config --global credential.helper store && \
repo init -u https://${username}:${userpassword}@gitee.com/openharmony/manifest.git -b master --repo-branch=stable --no-repo-verify && \
repo sync -c
# compile
#RUN python build.py ipcamera_hi3516dv300 -b debug
ENV LANGUAGE en
ENV LANG en_US.utf-8
RUN export|grep LANG
RUN ["/bin/bash", "-c", "source /etc/profile; python build.py ${HARDWARE} -b debug"]
# build final docker image
FROM ubuntu:20.04
RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \
sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \
apt-get -y update && \
apt-get install -y curl vim python3-pip && \
rm -rf /var/cache/apt/archives
COPY --from=build-env /OpenHarmony /OpenHarmony
VOLUME /OpenHarmony
ENV PATH=/OpenHarmony/bin:$PATH
#CMD python build.py ipcamera_hi3516dv300 -b debug
1
https://gitee.com/keithyau/build_lite.git
git@gitee.com:keithyau/build_lite.git
keithyau
build_lite
build_lite
master

搜索帮助