Skip to content

Commit 90843f1

Browse files
committed
ci: base v3 backend image
1 parent 0381acf commit 90843f1

2 files changed

Lines changed: 41 additions & 10 deletions

File tree

.github/workflows/base_ci.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ jobs:
5858
with:
5959
installer-parallel: true
6060

61-
- name: Build backend and push
62-
id: docker_build_backend
61+
- name: Build backend amd64 and push
62+
id: docker_build_backend_amd
6363
uses: docker/build-push-action@v2
6464
with:
6565
# backend 的context目录
@@ -68,22 +68,41 @@ jobs:
6868
# 是否 docker push
6969
push: true
7070
# docker build arg, 注入 APP_NAME/APP_VERSION
71-
platforms: linux/amd64,linux/arm64
71+
platforms: linux/amd64
7272
build-args: |
7373
APP_NAME="bisheng-backend"
7474
APP_VERSION=${{ steps.get_version.outputs.VERSION }}
75+
PANDOC_ARCH=amd64
7576
# 生成两个 docker tag: ${APP_VERSION} 和 latest
7677
tags: |
7778
${{ env.DOCKERHUB_REPO }}bisheng-backend:${{ steps.get_version.outputs.VERSION }}
78-
# 构建 Docker frontend 并推送到 Docker hub
79+
- name: Build backend arm64 and push
80+
id: docker_build_backend_arm
81+
uses: docker/build-push-action@v2
82+
with:
83+
# backend 的context目录
84+
context: "./src/backend/"
85+
file: ./src/backend/base.Dockerfile
86+
# 是否 docker push
87+
push: true
88+
# docker build arg, 注入 APP_NAME/APP_VERSION
89+
platforms: linux/arm64
90+
build-args: |
91+
APP_NAME="bisheng-backend"
92+
APP_VERSION=${{ steps.get_version.outputs.VERSION }}
93+
PANDOC_ARCH=arm64
94+
# 生成两个 docker tag: ${APP_VERSION} 和 latest
95+
tags: |
96+
${{ env.DOCKERHUB_REPO }}bisheng-backend:${{ steps.get_version.outputs.VERSION }}
97+
# 获取提交信息
7998
- name: Process git message
8099
id: process_message
81100
run: |
82101
value=$(echo "${{ github.event.head_commit.message }}" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/%0A/g')
83102
value=$(echo "${value}" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\r/%0A/g')
84103
echo "message=${value}" >> $GITHUB_ENV
85104
shell: bash
86-
105+
# 飞书通知
87106
- name: notify feishu
88107
uses: fjogeleit/http-request-action@v1
89108
with:

src/backend/base.Dockerfile

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM python:3.10-slim
22

3+
ARG PANDOC_ARCH=amd64
4+
ENV PANDOC_ARCH=$PANDOC_ARCH
5+
36
WORKDIR /app
47

58
RUN echo \
@@ -14,19 +17,28 @@ RUN echo \
1417
> /etc/apt/sources.list
1518

1619

17-
# Install Poetry
18-
RUN apt-get update && apt-get install gcc g++ curl build-essential postgresql-server-dev-all -y
20+
21+
# Install lib
22+
RUN apt-get update && apt-get install gcc g++ curl build-essential postgresql-server-dev-all wget -y
1923
RUN apt-get update && apt-get install procps -y
24+
25+
# Install pandoc
26+
RUN mkdir -p /opt/pandoc \
27+
&& cd /opt/pandoc \
28+
&& wget https://github.com/jgm/pandoc/releases/download/3.6.4/pandoc-3.6.4-linux-${PANDOC_ARCH}.tar.gz \
29+
&& tar xvf pandoc-3.6.4-linux-${PANDOC_ARCH}.tar.gz \
30+
&& cd pandoc-3.6.4 \
31+
&& cp bin/pandoc /usr/bin/ \
32+
&& cd ..
33+
2034
# Install font
2135
RUN apt install vim fonts-wqy-zenhei -y
2236
# opencv
2337
RUN apt-get update && apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6 libgl1
2438
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2
2539
# # Add Poetry to PATH
2640
ENV PATH="${PATH}:/root/.local/bin"
27-
# # Copy the pyproject.toml and poetry.lock files
28-
# COPY poetry.lock pyproject.toml ./
29-
# Copy the rest of the application codes
41+
3042
COPY ./pyproject.toml ./
3143

3244
RUN python -m pip install --upgrade pip && \

0 commit comments

Comments
 (0)