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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
67 changes: 67 additions & 0 deletions .github/workflows/ci-arm-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI ARM64 Build and Push

on:
# push:
sanderegg marked this conversation as resolved.
Show resolved Hide resolved
# 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
sanderegg marked this conversation as resolved.
Show resolved Hide resolved
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 for latest tag
run: |
export DOCKER_IMAGE_TAG="$TAG_PREFIX-latest-arm64"
export DOCKER_TARGET_PLATFORMS=linux/arm64
make build push=true
- name: build & push images for specific tag
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 for latest tag
sanderegg marked this conversation as resolved.
Show resolved Hide resolved
run: |
export DOCKER_IMAGE_TAG="$TAG_PREFIX-latest"
make docker-image-fuse SUFFIX=arm64
- name: set git tag
run: echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
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\
)\
)\
$(if $(push),\
$(foreach service, $(SERVICES_NAMES_TO_BUILD),\
--set $(service).tags=$(DOCKER_REGISTRY)/$(service):$(DOCKER_IMAGE_TAG) \
) \
$(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 create --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 "$@"
sanderegg marked this conversation as resolved.
Show resolved Hide resolved
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