Add option to create docker amd and arm images
This commit is contained in:
parent
eb369eee2a
commit
ca4fdc0a78
40
.github/workflows/package_memgraph.yaml
vendored
40
.github/workflows/package_memgraph.yaml
vendored
@ -29,6 +29,7 @@ on:
|
||||
- debian-12
|
||||
- debian-12-arm
|
||||
- docker
|
||||
- docker-arm
|
||||
- fedora-36
|
||||
- fedora-38
|
||||
- fedora-39
|
||||
@ -130,6 +131,7 @@ jobs:
|
||||
runner_arch_label: "ARM64"
|
||||
build_type: ${{ github.event.inputs.build_type }}
|
||||
timeout_minutes: 120
|
||||
artifact_name: "debian-11-aarch64"
|
||||
secrets: inherit
|
||||
|
||||
Debian12:
|
||||
@ -154,11 +156,12 @@ jobs:
|
||||
runner_arch_label: "ARM64"
|
||||
build_type: ${{ github.event.inputs.build_type }}
|
||||
timeout_minutes: 120
|
||||
artifact_name: "debian-12-aarch64"
|
||||
secrets: inherit
|
||||
|
||||
Docker-v4:
|
||||
if: ${{ (github.event.inputs.target_os == 'docker' || github.event.inputs.target_os == 'all') && github.event.inputs.toolchain == 'v4' }}
|
||||
uses: ./.github/workflows/reusable_package.yaml
|
||||
uses: ./.github/workflows/reusable_docker.yaml
|
||||
with:
|
||||
os: "debian-11"
|
||||
toolchain: ${{ github.event.inputs.toolchain }}
|
||||
@ -167,12 +170,12 @@ jobs:
|
||||
build_type: ${{ github.event.inputs.build_type }}
|
||||
timeout_minutes: 60
|
||||
additional_build_args: "--for-docker"
|
||||
artifact_name: "debian-11-docker"
|
||||
artifact_name: "docker"
|
||||
secrets: inherit
|
||||
|
||||
Docker-v5:
|
||||
if: ${{ (github.event.inputs.target_os == 'docker' || github.event.inputs.target_os == 'all') && github.event.inputs.toolchain == 'v5' }}
|
||||
uses: ./.github/workflows/reusable_package.yaml
|
||||
uses: ./.github/workflows/reusable_docker.yaml
|
||||
with:
|
||||
os: "debian-12"
|
||||
toolchain: ${{ github.event.inputs.toolchain }}
|
||||
@ -181,7 +184,35 @@ jobs:
|
||||
build_type: ${{ github.event.inputs.build_type }}
|
||||
timeout_minutes: 60
|
||||
additional_build_args: "--for-docker"
|
||||
artifact_name: "debian-11-docker"
|
||||
artifact_name: "docker"
|
||||
secrets: inherit
|
||||
|
||||
Docker-v4-arm:
|
||||
if: ${{ (github.event.inputs.target_os == 'docker-arm' || github.event.inputs.target_os == 'all') && github.event.inputs.toolchain == 'v4' }}
|
||||
uses: ./.github/workflows/reusable_docker.yaml
|
||||
with:
|
||||
os: "debian-11-arm"
|
||||
toolchain: ${{ github.event.inputs.toolchain }}
|
||||
arch: "arm"
|
||||
runner_arch_label: "ARM64"
|
||||
build_type: ${{ github.event.inputs.build_type }}
|
||||
timeout_minutes: 60
|
||||
additional_build_args: "--for-docker"
|
||||
artifact_name: "docker-aarch64"
|
||||
secrets: inherit
|
||||
|
||||
Docker-v5-arm:
|
||||
if: ${{ (github.event.inputs.target_os == 'docker-arm' || github.event.inputs.target_os == 'all') && github.event.inputs.toolchain == 'v5' }}
|
||||
uses: ./.github/workflows/reusable_docker.yaml
|
||||
with:
|
||||
os: "debian-12-arm"
|
||||
toolchain: ${{ github.event.inputs.toolchain }}
|
||||
arch: "arm"
|
||||
runner_arch_label: "ARM64"
|
||||
build_type: ${{ github.event.inputs.build_type }}
|
||||
timeout_minutes: 60
|
||||
additional_build_args: "--for-docker"
|
||||
artifact_name: "docker-aarch64"
|
||||
secrets: inherit
|
||||
|
||||
Fedora36:
|
||||
@ -278,4 +309,5 @@ jobs:
|
||||
runner_arch_label: "ARM64"
|
||||
build_type: ${{ github.event.inputs.build_type }}
|
||||
timeout_minutes: 120
|
||||
artifact_name: "ubuntu-22.04-aarch64"
|
||||
secrets: inherit
|
||||
|
27
.github/workflows/reusable_docker_package.yaml
vendored
27
.github/workflows/reusable_docker_package.yaml
vendored
@ -25,7 +25,7 @@ on:
|
||||
default: 'Release'
|
||||
artifact_name:
|
||||
type: string
|
||||
description: "Unique artifact name, pass it in to override the default. Default value is os name."
|
||||
description: "Unique artifact name, pass it in to override the default. Default value is docker-arch."
|
||||
default: ''
|
||||
additional_build_args:
|
||||
type: string
|
||||
@ -50,7 +50,7 @@ on:
|
||||
description: "Target dir path in S3 bucket."
|
||||
|
||||
env:
|
||||
ARTIFACT_NAME: ${{ inputs.artifact_name || inputs.os }}
|
||||
ARTIFACT_NAME: "docker-${{ inputs.arch }}"
|
||||
|
||||
jobs:
|
||||
package:
|
||||
@ -108,7 +108,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME }}
|
||||
path: "build/output/${{ inputs.os }}/memgraph*"
|
||||
path: "build/output/docker/${{ inputs.arch }}/${{ inputs.toolchain }}/memgraph*"
|
||||
|
||||
- name: "Stop mgbuild container"
|
||||
if: always()
|
||||
@ -139,24 +139,3 @@ jobs:
|
||||
AWS_REGION: ${{ inputs.s3_region }}
|
||||
SOURCE_DIR: "build/output/release"
|
||||
DEST_DIR: ${{ inputs.s3_dest_dir }}
|
||||
|
||||
# MAKE DOCKER WORK
|
||||
# docker:
|
||||
# if: ${{ inputs.target_os == 'docker' || inputs.target_os == 'all' }}
|
||||
# runs-on: [self-hosted, DockerMgBuild, X64]
|
||||
# timeout-minutes: 60
|
||||
# steps:
|
||||
# - name: "Set up repository"
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# fetch-depth: 0 # Required because of release/get_version.py
|
||||
# - name: "Build package"
|
||||
# run: |
|
||||
# cd release/package
|
||||
# ./run.sh package debian-11 ${{ inputs.build_type }} --for-docker
|
||||
# ./run.sh docker
|
||||
# - name: "Upload package"
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: docker
|
||||
# path: build/output/docker/memgraph*.tar.gz
|
||||
|
@ -15,6 +15,7 @@ latest_image=""
|
||||
tag_latest=""
|
||||
toolchain_version="v5"
|
||||
package_path=""
|
||||
arch=""
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--latest)
|
||||
@ -30,6 +31,10 @@ while [[ $# -gt 0 ]]; do
|
||||
toolchain_version=$2
|
||||
shift 2
|
||||
;;
|
||||
--arch)
|
||||
arch=$2
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
print_help
|
||||
exit 0
|
||||
@ -56,13 +61,13 @@ if [[ "$extension" == "deb" ]]; then
|
||||
# Extract version and offering from deb name.
|
||||
package_name=`echo $(basename "$package_path") | sed 's/.deb$//'`
|
||||
version=`echo ${package_name} | cut -d '_' -f 2 | rev | cut -d '-' -f 2- | rev | tr '+~' '__'`
|
||||
dockerfile_path="${working_dir}/memgraph_deb.dockerfile"
|
||||
dockerfile_path="${working_dir}/${toolchain_version}_deb.dockerfile"
|
||||
elif [[ "$extension" == "rpm" ]]; then
|
||||
# Extract version and offering from deb name.
|
||||
package_name=`echo $(basename "$package_path") | sed 's/.rpm$//'`
|
||||
version=`echo ${package_name} | cut -d '-' -f 2 | rev | cut -d '-' -f 2- | rev`
|
||||
version=${version%_1}
|
||||
dockerfile_path="${working_dir}/memgraph_rpm.dockerfile"
|
||||
dockerfile_path="${working_dir}/${toolchain_version}_rpm.dockerfile"
|
||||
else
|
||||
echo "Invalid file sent as the package"
|
||||
print_help
|
||||
@ -70,7 +75,7 @@ else
|
||||
fi
|
||||
|
||||
image_name="memgraph:${version}"
|
||||
image_package_name="memgraph-${version}-docker.tar.gz"
|
||||
image_package_name="memgraph-${version}-docker-${arch}.tar.gz"
|
||||
|
||||
# Build docker image.
|
||||
# NOTE: --pull is here to always pull that latest base image because of security patches.
|
||||
@ -80,4 +85,5 @@ docker build --pull -t ${image_name} ${tag_latest} -f ${dockerfile_path} \
|
||||
--build-arg TARGETARCH="" .
|
||||
docker save ${image_name} ${latest_image} | gzip > ${image_package_name}
|
||||
rm "${package_name}.${extension}"
|
||||
docker image rm $image_name
|
||||
echo "Built Docker image at '${working_dir}/${image_package_name}'"
|
||||
|
@ -371,13 +371,13 @@ package_docker() {
|
||||
local last_package_name=$(cd $package_dir && ls -t memgraph* | head -1)
|
||||
local docker_build_folder="$PROJECT_ROOT/release/docker"
|
||||
cd "$docker_build_folder"
|
||||
./package_docker --latest "$package_dir/$last_package_name" $toolchain_version
|
||||
./package_docker --latest --package-path "$package_dir/$last_package_name" --toolchain $toolchain_version --arch "${arch}64"
|
||||
# shellcheck disable=SC2012
|
||||
local docker_image_name=$(cd "$docker_build_folder" && ls -t memgraph* | head -1)
|
||||
local docker_host_folder="$PROJECT_ROOT/build/output/docker-${toolchain_version}"
|
||||
local docker_host_folder="$PROJECT_ROOT/build/output/docker/${arch}/${toolchain_version}"
|
||||
local docker_host_image_path="$docker_host_folder/$docker_image_name"
|
||||
mkdir -p "$docker_host_folder"
|
||||
cp "$docker_build_folder/$docker_image_name" "$docker_host_image_path"
|
||||
cp "$docker_build_folder/$docker_image_name" "$docker_host_folder"
|
||||
echo "Docker images saved to $docker_host_image_path."
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user