Skip to content

Commit a5cdda3

Browse files
committed
build: Removed platform parameters, added multi-platform builds and simplified image tags
1 parent 1eed11f commit a5cdda3

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

.github/workflows/docker-image.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- main
6+
67
jobs:
78
build-app:
89
runs-on: ubuntu-latest
@@ -12,33 +13,15 @@ jobs:
1213
- service_name: ui
1314
file: frontend/Dockerfile
1415
context: ./frontend
15-
arch: amd64
16-
platform: linux/amd64
17-
- service_name: app
18-
file: docker/Dockerfile.app
19-
context: .
20-
arch: amd64
21-
platform: linux/amd64
22-
- service_name: docreader
23-
file: docker/Dockerfile.docreader
24-
context: .
25-
arch: amd64
26-
platform: linux/amd64
27-
- service_name: ui
28-
file: frontend/Dockerfile
29-
context: ./frontend
30-
arch: arm64
31-
platform: linux/arm64
16+
platform: linux/amd64,linux/arm64
3217
- service_name: app
3318
file: docker/Dockerfile.app
3419
context: .
35-
arch: arm64
36-
platform: linux/arm64
20+
platform: linux/amd64,linux/arm64
3721
- service_name: docreader
3822
file: docker/Dockerfile.docreader
3923
context: .
40-
arch: arm64
41-
platform: linux/arm64
24+
platform: linux/amd64,linux/arm64
4225
steps:
4326
- name: Checkout code
4427
uses: actions/checkout@v3
@@ -62,6 +45,4 @@ jobs:
6245
platforms: ${{ matrix.platform }}
6346
file: ${{ matrix.file }}
6447
context: ${{ matrix.context }}
65-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-${{ matrix.service_name }}:${{ matrix.arch }}-latest
66-
build-args: |
67-
PLATFORM=${{ matrix.platform }}
48+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-${{ matrix.service_name }}:latest

docker/Dockerfile.docreader

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
ARG PLATFORM=linux/amd64
2-
31
# =========================
42
# 构建阶段
53
# =========================
6-
FROM --platform=${PLATFORM} python:3.10.18-bookworm AS builder
4+
FROM python:3.10.18-bookworm AS builder
75

86
# 切换 apt 源到清华
97
RUN sed -i 's@http://deb.debian.org@https://mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources && \
@@ -63,7 +61,7 @@ RUN chmod +x /app/scripts/generate_proto.sh && bash /app/scripts/generate_proto.
6361
# =========================
6462
# 运行阶段
6563
# =========================
66-
FROM --platform=${PLATFORM} python:3.10.18-bookworm AS runner
64+
FROM python:3.10.18-bookworm AS runner
6765

6866
# 切换 apt 源到清华
6967
RUN sed -i 's@http://deb.debian.org@https://mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources && \

0 commit comments

Comments
 (0)