add raspberry pi develop dockerfile.

This commit is contained in:
amass 2022-12-29 19:45:59 +08:00
parent d7e6243168
commit 3312cf8ba5
2 changed files with 119 additions and 1 deletions

View File

@ -11,4 +11,25 @@ steps:
dockerfile: mkdocs.dockerfile
username: 168062547@qq.com
password:
from_secret: docker_password
from_secret: docker_password
- name: wechat
image: lizheming/drone-wechat
settings:
corpid:
from_secret: wechat_corpid
corp_secret:
from_secret: wechat_corp_secret
agent_id:
from_secret: agent_id
to_user: '@all'
to_tag: ${DRONE_REPO_NAME}
msg_url: ${DRONE_BUILD_LINK}
safe: 1
btn_txt: more
title: ${DRONE_REPO_NAME}
message: >
{%if success %}
build {{build.number}} succeeded. Good job.
{% else %}
build {{build.number}} failed. Fix me please.
{% endif %}

97
raspberrypi.dockerfile Normal file
View File

@ -0,0 +1,97 @@
FROM ubuntu:22.04
LABEL maintainer 168062547@qq.com
ENV DEBIAN_FRONTEND=noninteractive
ARG PI_ADDRESS
RUN sed -i "s@http://.*archive.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && \
sed -i "s@http://.*security.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && \
apt-get update && \
apt-get install -y wget rsync openssh-client xz-utils cmake ninja-build pkg-config file gcc g++ python3
WORKDIR /opt/RaspberryPi
RUN mkdir -p sysroot sysroot/usr sysroot/opt && \
mkdir -p -m 0700 ~/.ssh && ssh-keyscan $PI_ADDRESS >> ~/.ssh/known_hosts
RUN --mount=type=ssh \
ssh pi@$PI_ADDRESS sudo apt install libalsa-ocaml-dev libffmpeg-ocaml-dev libcurl4-openssl-dev libssl-dev liblzma-dev libx264-dev && \
rsync -avz --ignore-errors pi@$PI_ADDRESS:/lib sysroot && \
rsync -avz --ignore-errors pi@$PI_ADDRESS:/usr/include sysroot/usr && \
rsync -avz --ignore-errors --exclude lib/chromium-browser --exclude lib/libreoffice --exclude lib/scratch3 \
--exclude lib/debug --exclude lib/arm-linux-gnueabihf/dri \
--exclude lib/kernel --exclude lib/firmware --exclude lib/modules \
--exclude lib/ruby --exclude lib/pypy --exclude lib/python2.7 --exclude lib/python3 --exclude lib/python3.9 \
pi@$PI_ADDRESS:/usr/lib sysroot/usr ;exit 0
ADD resources/sysroot-relativelinks.py resources/raspberrypi.cmake /opt/RaspberryPi/
RUN ./sysroot-relativelinks.py sysroot
WORKDIR /opt/RaspberryPi/sysroot/usr/lib
RUN ln -s arm-linux-gnueabihf/crt1.o crt1.o && \
ln -s arm-linux-gnueabihf/crti.o crti.o && \
ln -s arm-linux-gnueabihf/crtn.o crtn.o && \
ln -s arm-linux-gnueabihf/libc.a libc.a && \
ln -s arm-linux-gnueabihf/libc.so.6 libc.so.6 && \
ln -s arm-linux-gnueabihf/libpthread.a libpthread.a && \
ln -s arm-linux-gnueabihf/libm.a libm.a && \
ln -s arm-linux-gnueabihf/libdl.a libdl.a && \
ln -sb blas/libblas.so.3 arm-linux-gnueabihf/libblas.so.3 && \
ln -sb lapack/liblapack.so.3 arm-linux-gnueabihf/liblapack.so.3
WORKDIR /home/temp
RUN wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.2-2020.11/binrel/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz && \
wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz && \
wget https://github.com/zeromq/libzmq/releases/download/v4.3.4/zeromq-4.3.4.tar.gz && \
wget https://github.com/tfussell/xlnt/archive/refs/tags/v1.5.0.tar.gz -O xlnt-1.5.0.tar.gz
RUN tar xvf gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz -C /opt && \
tar xvf boost_1_81_0.tar.gz && \
tar xvf zeromq-4.3.4.tar.gz && \
tar xvf xlnt-1.5.0.tar.gz
WORKDIR /home/temp/boost_1_81_0
RUN ./bootstrap.sh --prefix=/opt/RaspberryPi/boost_1_81_0
RUN sed -i -e "s/using gcc ;/using gcc : : \/opt\/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf\/bin\/arm-none-linux-gnueabihf-gcc ;/g" project-config.jam
RUN ./b2 install -q --prefix=/opt/RaspberryPi/boost_1_81_0 link=shared threading=multi runtime-link=shared variant=release cxxstd=17
WORKDIR /home/temp/zeromq-4.3.4/build
RUN cmake \
-G Ninja \
-DCMAKE_TOOLCHAIN_FILE=/opt/RaspberryPi/raspberrypi.cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/opt/RaspberryPi/zeromq-4.3.4_debug \
..
RUN ninja install
RUN rm -fr ./*
RUN cmake \
-G Ninja \
-DCMAKE_TOOLCHAIN_FILE=/opt/RaspberryPi/raspberrypi.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/RaspberryPi/zeromq-4.3.4_release \
..
RUN ninja install
WORKDIR /home/temp/xlnt-1.5.0/build
RUN sed -i '1s/^/#include <limits>\n/' ../source/detail/number_format/number_formatter.cpp
RUN cmake \
-G Ninja \
-DCMAKE_TOOLCHAIN_FILE=/opt/RaspberryPi/raspberrypi.cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/opt/RaspberryPi/xlnt-1.5.0_debug \
..
RUN ninja install
RUN rm -fr ./*
RUN cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/RaspberryPi/xlnt-1.5.0_release \
..
RUN ninja install
RUN bash -c "sed -i -e 's/set_and_check(XLNT_INCLUDE_DIR \"include\")/# set_and_check(XLNT_INCLUDE_DIR \"include\")/g' /opt/RaspberryPi/xlnt-1.5.0_debug/lib/cmake/xlnt/XlntConfig.cmake &&\
sed -i -e 's/set_and_check(XLNT_INCLUDE_DIR \"include\")/# set_and_check(XLNT_INCLUDE_DIR \"include\")/g' /opt/RaspberryPi/xlnt-1.5.0_release/lib/cmake/xlnt/XlntConfig.cmake"
RUN rm -fr /home/temp
ENV LANG C.UTF-8
# eval $(ssh-agent) && ssh-add ~/.ssh/id_rsa
# docker build -f raspberrypi.dockerfile -t raspberrypi --build-arg PI_ADDRESS="192.168.1.2" --ssh default=$SSH_AUTH_SOCK .