Skip to content
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

✨Infra: Build for arm64 #6984

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
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
65 changes: 65 additions & 0 deletions .github/workflows/ci-arm-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI ARM64 Build and Push

on:
# push:
# branches:
# - "master"
# tags-ignore:
# - "*"
# pull_request:
# branches-ignore:
# - "*"
workflow_dispatch:

jobs:
build-and-push-arm64:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-22.04]
python: ["3.11"]
env:
# secrets can be set in settings/secrets on github
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
steps:
- uses: actions/checkout@v4
- name: setup QEMU
uses: docker/setup-qemu-action@v3
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: expose github runtime for buildx
uses: crazy-max/ghaction-github-runtime@v3
- name: show system environs
run: ./ci/helpers/show_system_versions.bash
- name: login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set deployment variables
run: |
if [ "${GITHUB_REF}" == "refs/heads/master" ]; then
echo "TAG_PREFIX=master-github" >> $GITHUB_ENV
elif [[ "${GITHUB_REF}" == refs/heads/hotfix_v* ]]; then
echo "TAG_PREFIX=hotfix-github" >> $GITHUB_ENV
elif [[ "${GITHUB_REF}" == refs/heads/hotfix_staging_* ]]; then
echo "TAG_PREFIX=hotfix-staging-github" >> $GITHUB_ENV
fi
- name: build & push images
run: |
export DOCKER_IMAGE_TAG="$TAG_PREFIX-latest-arm64"
export DOCKER_TARGET_PLATFORMS=linux/arm64
make build push=true
- name: build & push images
run: |
export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)-arm64
export DOCKER_TARGET_PLATFORMS=linux/arm64
make build push=true
- name: fuse images in the registry
run: |
export DOCKER_IMAGE_TAG="$TAG_PREFIX-latest-arm64"
make docker-image-fuse SUFFIX=arm64
6 changes: 6 additions & 0 deletions .github/workflows/ci-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ jobs:
name: "[build] docker images (excluding frontend)"
steps:
- uses: actions/checkout@v4
- name: setup QEMU
uses: docker/setup-qemu-action@v3
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -287,6 +289,7 @@ jobs:
- name: build images
run: |
export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)
export DOCKER_TARGET_PLATFORMS=linux/amd64
mkdir --parents /${{ runner.temp }}/build
make build local-dest=/${{ runner.temp }}/build exclude=static-webserver
- name: upload build artifacts
Expand All @@ -310,6 +313,8 @@ jobs:
name: "[build] docker images (frontend-only)"
steps:
- uses: actions/checkout@v4
- name: setup QEMU
uses: docker/setup-qemu-action@v3
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -322,6 +327,7 @@ jobs:
- name: build images
run: |
export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)
export DOCKER_TARGET_PLATFORMS=linux/amd64
mkdir --parents /${{ runner.temp }}/build
make build local-dest=/${{ runner.temp }}/build target=static-webserver
- name: upload build artifacts
Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,16 @@ docker buildx bake --allow=fs.read=.. \
,--load\
)\
)\
$(foreach service, $(SERVICES_NAMES_TO_BUILD),\
--set $(service).tags=$(DOCKER_REGISTRY)/$(service):$(DOCKER_IMAGE_TAG) \
) \
$(if $(push),\
$(foreach service, $(SERVICES_NAMES_TO_BUILD),\
--set $(service).output="type=registry$(comma)push=true" \
)\
,) \
$(if $(push),--push,) \
$(if $(push),--file docker-bake.hcl,) --file docker-compose-build.yml $(if $(target),$(target),$(INCLUDED_SERVICES)) \
--file docker-compose-build.yml $(if $(target),$(target),$(INCLUDED_SERVICES)) \
$(if $(findstring -nc,$@),--no-cache,\
$(foreach service, $(SERVICES_NAMES_TO_BUILD),\
--set $(service).cache-to=type=gha$(comma)mode=max$(comma)scope=$(service) \
Expand Down Expand Up @@ -859,3 +867,8 @@ release-staging release-prod: .check-on-master-branch ## Helper to create a sta
.PHONY: release-hotfix release-staging-hotfix
release-hotfix release-staging-hotfix: ## Helper to create a hotfix release in Github (usage: make release-hotfix version=1.2.4 git_sha=optional or make release-staging-hotfix name=Sprint version=2)
$(create_github_release_url)

.PHONY: docker-image-fuse
docker-image-fuse:
$(foreach service, $(SERVICES_NAMES_TO_BUILD),\
docker buildx imagetools --tag $(DOCKER_REGISTRY)/$(service):$(DOCKER_IMAGE_TAG) $(DOCKER_REGISTRY)/$(service):$(DOCKER_IMAGE_TAG)-$(SUFFIX) $(DOCKER_REGISTRY)/$(service):$(DOCKER_IMAGE_TAG))
10 changes: 7 additions & 3 deletions scripts/install_rclone.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

R_CLONE_VERSION="1.63.1"
curl --silent --location --remote-name "https://downloads.rclone.org/v${R_CLONE_VERSION}/rclone-v${R_CLONE_VERSION}-linux-amd64.deb"
dpkg --install "rclone-v${R_CLONE_VERSION}-linux-amd64.deb"
rm "rclone-v${R_CLONE_VERSION}-linux-amd64.deb"
TARGETARCH="${TARGETARCH:-amd64}"

echo "platform ${TARGETARCH}"

curl --silent --location --remote-name "https://downloads.rclone.org/v${R_CLONE_VERSION}/rclone-v${R_CLONE_VERSION}-linux-${TARGETARCH}.deb"
dpkg --install "rclone-v${R_CLONE_VERSION}-linux-${TARGETARCH}.deb"
rm "rclone-v${R_CLONE_VERSION}-linux-${TARGETARCH}.deb"
rclone --version
2 changes: 1 addition & 1 deletion scripts/shellcheck.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# - VS extension: https://github.com/timonwong/vscode-shellcheck
#

exec docker run --rm --interactive --volume "$PWD:/mnt:ro" koalaman/shellcheck:v0.9.0 "$@"
exec docker run --rm --interactive --volume "$PWD:/mnt:ro" koalaman/shellcheck:v0.10.0 "$@"
4 changes: 4 additions & 0 deletions services/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# Define arguments in the global scope
ARG PYTHON_VERSION="3.11.9"
ARG UV_VERSION="0.4"

FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
# we docker image is built based on debian
FROM python:${PYTHON_VERSION}-slim-bookworm AS base


#
# USAGE:
# cd sercices/agent
Expand Down Expand Up @@ -57,6 +59,8 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"

# rclone installation
ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH}
RUN \
--mount=type=bind,source=scripts/install_rclone.bash,target=/tmp/install_rclone.bash \
./tmp/install_rclone.bash
Expand Down
12 changes: 0 additions & 12 deletions services/docker-bake.hcl

This file was deleted.

9 changes: 8 additions & 1 deletion services/dynamic-sidecar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,19 @@ RUN \
&& gosu nobody true

# install RClone, we do it in a separate layer such that the cache is not locked forever, as this seems to take a long time
ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH}
RUN \
--mount=type=bind,source=scripts/install_rclone.bash,target=install_rclone.bash \
./install_rclone.bash

RUN AWS_CLI_VERSION="2.11.11" \
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip" -o "awscliv2.zip" \
&& case "${TARGETARCH}" in \
"amd64") ARCH="x86_64" ;; \
"arm64") ARCH="aarch64" ;; \
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
esac \
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}-${AWS_CLI_VERSION}.zip" -o "awscliv2.zip" \
&& apt-get update && apt-get install -y unzip \
&& unzip awscliv2.zip \
&& ./aws/install \
Expand Down
Loading