Skip to content

added multi-arch build for docker. #553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/docker_multiarch_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

name: ci-docker-multi-arch
on:
push:
tags:
- "v[0-9].[0-9]+.[0-9]+*"

jobs:
docker:
name: Build base image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Get Release Tag
run: |
TAG=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
echo "VERSION=$(echo $TAG | sed 's/v//')" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./deploy/docker
push: true
tags: daxaai/pebblo:${{ env.VERSION }}
platforms: linux/amd64,linux/arm64
file: ./deploy/docker/Dockerfile.base
build-args: |
"build_image=python:3.11"
"base_image=python:3.11"
"pebblo_branch=${{ env.VERSION }}"
4 changes: 1 addition & 3 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Docker image release

on:
push:
tags:
- "v[0-9].[0-9]+.[0-9]+*"
workflow_dispatch:
jobs:
build-and-push:
name: Build base image
Expand Down
14 changes: 7 additions & 7 deletions deploy/docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG build_image
ARG base_image
ARG pebblo_version
ARG build_image=python:3.11
ARG base_image=python:3.11
ARG pebblo_branch=main

FROM $build_image AS base
FROM --platform=$BUILDPLATFORM $build_image AS base

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

WORKDIR /opt/pebblo

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

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

# Stage 2
FROM $base_image
FROM --platform=$BUILDPLATFORM $base_image

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

Expand Down