From 73588449d2732daf29d5f183fd4ad4a2f412f415 Mon Sep 17 00:00:00 2001 From: ARC-MX Date: Mon, 3 Jun 2024 16:55:02 +0800 Subject: [PATCH] add amr v7 --- .github/workflows/docker-image.yml | 5 +-- Dockerfile-for-github-action-armv7 | 49 ++++++++++++++++++++++++++++++ requirements-armv7.txt | 9 ++++++ 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 Dockerfile-for-github-action-armv7 create mode 100644 requirements-armv7.txt diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 2e4d1b1..0f1f508 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -6,6 +6,7 @@ on: - 'scripts/**' - 'Dockerfile-for-github-action' - 'requirements.txt' + - 'requirements-armv7.txt' - 'example.env' - '.github/workflows/docker-image.yml' @@ -26,6 +27,6 @@ jobs: - name: Build and push Docker image run: | - PLATFORMS=linux/arm64,linux/amd64 + PLATFORMS=linux/arm/v7 DOCKER_IMAGE=arcw/sgcc_electricity - docker buildx build --platform $PLATFORMS -t $DOCKER_IMAGE:latest -t $DOCKER_IMAGE:1.3.3 --file Dockerfile-for-github-action --push . \ No newline at end of file + docker buildx build --platform $PLATFORMS -t $DOCKER_IMAGE:armv7 -t $DOCKER_IMAGE:1.3.3 --file Dockerfile-for-github-action-armv7 --push . \ No newline at end of file diff --git a/Dockerfile-for-github-action-armv7 b/Dockerfile-for-github-action-armv7 new file mode 100644 index 0000000..addf8bb --- /dev/null +++ b/Dockerfile-for-github-action-armv7 @@ -0,0 +1,49 @@ +FROM python:3.9-bullseye as build + +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +ARG TARGETOS +ARG TARGETARCH + +WORKDIR /app + +# COPY scripts/* /app/ +COPY ./requirements.txt /tmp/requirements.txt +COPY ./requirements-armv7.txt /tmp/requirements-armv7.txt + +RUN apt-get --allow-releaseinfo-change update \ + && apt-get install -y --no-install-recommends jq chromium chromium-driver tzdata cmake \ + && ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && dpkg-reconfigure --frontend noninteractive tzdata \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get clean + +RUN cd /tmp \ + && python3 -m pip install --upgrade pip + +RUN if [${TARGETARCH} == "arm"]; then \ + cd /tmp \ + && curl -O -L https://github.com/nknytk/built-onnxruntime-for-raspberrypi-linux/raw/master/wheels/buster/onnxruntime-1.8.1-cp39-cp39-linux_armv7l.whl \ + && PIP_ROOT_USER_ACTION=ignore pip3 install onnxruntime-1.8.1-cp39-cp39-linux_armv7l.whl \ + && PIP_ROOT_USER_ACTION=ignore pip3 install cmake==3.14.3; \ + fi + +# RUN if [${TARGETARCH} == "arm64"]; then \ +# cd /tmp \ +# && PIP_ROOT_USER_ACTION=ignore pip3 install onnxruntime==1.8.1; \ +# fi + +RUN cd /tmp \ + && PIP_ROOT_USER_ACTION=ignore pip install \ + --disable-pip-version-check \ + --no-cache-dir \ + -r requirements-armv7.txt \ + && rm -rf /tmp/* \ + && pip cache purge \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /var/log/* + +ENV LANG C.UTF-8 + +CMD ["python"] \ No newline at end of file diff --git a/requirements-armv7.txt b/requirements-armv7.txt new file mode 100644 index 0000000..202aae7 --- /dev/null +++ b/requirements-armv7.txt @@ -0,0 +1,9 @@ +numpy~=1.25.1 +opencv-python-headless~=4.5.3 +requests==2.31.0 +selenium~=4.5.0 +schedule==1.1.0 +Pillow~=9.3.0 +undetected_chromedriver==3.4.7 +pymongo~=3.12.0 +python-dotenv \ No newline at end of file