Skip to content

Commit 67fd5d3

Browse files
rajburnwal07Raj Burnwal
andauthored
added multi-arch build for docker. (#553)
* added multi-arch build for pebblo docker. --------- Co-authored-by: Raj Burnwal <[email protected]>
1 parent 0c8ff50 commit 67fd5d3

File tree

3 files changed

+50
-10
lines changed

3 files changed

+50
-10
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
name: ci-docker-multi-arch
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9].[0-9]+.[0-9]+*"
7+
8+
jobs:
9+
docker:
10+
name: Build base image
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v3
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
21+
- name: Login to Docker Hub
22+
uses: docker/login-action@v3
23+
with:
24+
username: ${{ secrets.DOCKER_HUB_USER }}
25+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
26+
27+
- name: Get Release Tag
28+
run: |
29+
TAG=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
30+
echo "VERSION=$(echo $TAG | sed 's/v//')" >> $GITHUB_ENV
31+
- name: Build and push
32+
uses: docker/build-push-action@v6
33+
with:
34+
context: ./deploy/docker
35+
push: true
36+
tags: daxaai/pebblo:${{ env.VERSION }}
37+
platforms: linux/amd64,linux/arm64
38+
file: ./deploy/docker/Dockerfile.base
39+
build-args: |
40+
"build_image=python:3.11"
41+
"base_image=python:3.11"
42+
"pebblo_branch=${{ env.VERSION }}"

.github/workflows/docker_release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Docker image release
22

33
on:
4-
push:
5-
tags:
6-
- "v[0-9].[0-9]+.[0-9]+*"
4+
workflow_dispatch:
75
jobs:
86
build-and-push:
97
name: Build base image

deploy/docker/Dockerfile.base

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
ARG build_image
2-
ARG base_image
3-
ARG pebblo_version
1+
ARG build_image=python:3.11
2+
ARG base_image=python:3.11
3+
ARG pebblo_branch=main
44

5-
FROM $build_image AS base
5+
FROM --platform=$BUILDPLATFORM $build_image AS base
66

77
RUN mkdir /opt/pebblo && apt-get update && \
88
apt-get install -y --no-install-recommends \
@@ -11,12 +11,12 @@ RUN mkdir /opt/pebblo && apt-get update && \
1111

1212
WORKDIR /opt/pebblo
1313

14-
RUN git clone https://github.com/daxa-ai/pebblo.git /opt/pebblo && git checkout $pebblo_version
14+
RUN git clone https://github.com/daxa-ai/pebblo.git /opt/pebblo && git checkout $pebblo_branch
1515

16-
RUN pip install weasyprint && pip install build && python -m build --wheel && pip install dist/*.whl
16+
RUN pip install weasyprint build && python -m build --wheel && pip install dist/*.whl
1717

1818
# Stage 2
19-
FROM $base_image
19+
FROM --platform=$BUILDPLATFORM $base_image
2020

2121
RUN mkdir /opt/pebblo /opt/.pebblo /opt/pebblo/log /opt/pebblo/config
2222

0 commit comments

Comments
 (0)