From 73ea5949bbb8e99bacd16d1cada2a444861a9cfa Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 21 Oct 2024 21:51:47 +0200 Subject: [PATCH] make the docker build more customizeable (#331) --- docker/Dockerfile.base | 5 ++++- docker/docker-bake.hcl | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 48523af1..247f9512 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -4,7 +4,9 @@ ARG dist_image FROM $build_image AS build-image ARG llama_deploy_version +ARG llama_deploy_version_sha ARG llama_deploy_extras="" +ARG git_clone_options RUN apt-get update && \ apt-get install -y --no-install-recommends \ @@ -12,8 +14,9 @@ RUN apt-get update && \ git # Shallow clone the repo, we install from git -RUN git clone --depth=1 --branch=${llama_deploy_version} https://github.com/run-llama/llama_deploy.git /opt/llama_deploy +RUN git clone ${git_clone_options} --branch=${llama_deploy_version} https://github.com/run-llama/llama_deploy.git /opt/llama_deploy WORKDIR /opt/llama_deploy +RUN git checkout ${llama_deploy_version_sha} # Use a virtualenv we can copy over the next build stage RUN python3 -m venv --system-site-packages /opt/venv diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index 8681f9d2..24d6cded 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -10,6 +10,14 @@ variable "LLAMA_DEPLOY_VERSION" { default = "main" } +variable "LLAMA_DEPLOY_VERSION_SHA" { + default = "" +} + +variable "GIT_CLONE_OPTIONS" { + default = "--depth=1" +} + variable "BUILD_IMAGE" { default = "python:3.12-slim" } @@ -29,7 +37,9 @@ target "default" { build_image = "${BUILD_IMAGE}" dist_image = "${DIST_IMAGE}" llama_deploy_version = "${LLAMA_DEPLOY_VERSION}" + llama_deploy_version_sha = "${LLAMA_DEPLOY_VERSION_SHA}" llama_deploy_extras = "[awssqs, rabbitmq, kafka, redis]" + git_clone_options = "${GIT_CLONE_OPTIONS}" apiserver_port = "${APISERVER_PORT}" } platforms = ["linux/amd64", "linux/arm64"]