Skip to content
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
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,32 @@ _docker-build:
scripts/build-images.sh $$target_arg ${DOCKER_BUILD_ARCH_FLAGS} ${DOCKER_BUILD_PUSH_FLAGS} --tag "$$tag" --registry "$${registry}" --registry-directory "$${directory}"

docker-build-test: login-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=test-connectivity
$(MAKE) _docker-build DOCKER_BUILD_TARGET=test

docker-build-tyger-server: login-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=tyger-server
docker-build-server: login-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=server

docker-build-buffer-sidecar: login-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=buffer-sidecar
docker-build-client: login-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=client

docker-build-helm: login-acr
$(MAKE) _docker-build DOCKER_BUILD_TARGET=helm

docker-build: docker-build-test docker-build-tyger-server docker-build-buffer-sidecar
docker-build: docker-build-test docker-build-server docker-build-client

publish-official-images:
container_registry_spec=$$(echo '${DEVELOPER_CONFIG_JSON}' | jq -c '.officialPushContainerRegistry')
export EXPLICIT_IMAGE_TAG="$$(git describe --tags)"
$(MAKE) DOCKER_BUILD_ARCH_FLAGS="--arch amd64 --arch arm64" CONTAINER_REGISTRY_SPEC="$${container_registry_spec}" docker-build docker-build-helm
$(MAKE) DOCKER_BUILD_ARCH_FLAGS="--arch amd64 --arch arm64" CONTAINER_REGISTRY_SPEC="$${container_registry_spec}" docker-build-server docker-build-client docker-build-helm

publish-ghcr:
container_registry_spec="{\"fqdn\": \"ghcr.io\", \"directory\": \"/$${GITHUB_REPOSITORY}\"}"
$(MAKE) DOCKER_BUILD_ARCH_FLAGS="--arch amd64 --arch arm64" CONTAINER_REGISTRY_SPEC="$${container_registry_spec}" docker-build docker-build-helm
$(MAKE) DOCKER_BUILD_ARCH_FLAGS="--arch amd64 --arch arm64" CONTAINER_REGISTRY_SPEC="$${container_registry_spec}" docker-build-server docker-build-client docker-build-helm

prepare-wip-binaries:
tag="$$(git describe --tags)-$$(date +'%Y%m%d%H%M%S')"
export EXPLICIT_IMAGE_TAG=$${tag}
$(MAKE) DOCKER_BUILD_ARCH_FLAGS="--arch amd64 --arch arm64" docker-build docker-build-helm
$(MAKE) DOCKER_BUILD_ARCH_FLAGS="--arch amd64 --arch arm64" docker-build-server docker-build-client docker-build-helm
$(MAKE) install-cli

integration-test-no-up-prereqs:
Expand Down
4 changes: 2 additions & 2 deletions Makefile.cloud
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ set-localsettings: set-context
}
EOF

up: install-cli ensure-environment-conditionally docker-build-tyger-server docker-build-buffer-sidecar docker-build-test
up: install-cli ensure-environment-conditionally docker-build-server docker-build-client docker-build-test
tyger api install -f <(scripts/get-config.sh)
$(MAKE) cli-ready

down: install-cli
tyger api uninstall -f <(scripts/get-config.sh)

migrate: ensure-environment-conditionally docker-build-tyger-server
migrate: ensure-environment-conditionally docker-build-server
tyger api migrations apply --latest --wait -f <(scripts/get-config.sh)

download-test-client-cert:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ set-data-plane-localsettings:
}
EOF

up: ensure-data-plane-cert install-cli docker-build-tyger-server docker-build-buffer-sidecar docker-build-test
up: ensure-data-plane-cert install-cli docker-build-server docker-build-client docker-build-test
tyger api install -f <(scripts/get-config.sh --docker)

down: install-cli
Expand Down
86 changes: 35 additions & 51 deletions scripts/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Usage: $0 [options]

Options:
-r, --registry The FQDN of container registry to push to.
--test-connectivity Build (and optionally push) the testconnectivity image
--tyger-server Build (and optionally push) the tyger-server image
--buffer-sidecar Build (and optionally push) the buffer-sidecar image
--test Build (and optionally push) the test images
--server Build (and optionally push) the server images (i.e. the C# code)
--client Build (and optionally push) the client images (i.e. the Go code)
--helm Package and push the Tyger Helm chart
--registry-directory The parent directory of the repositories. e.g. <registry>/<registry-dir>/<repo-name>
--arch amd64|arm64 The architecture to build for. Can be specified multiple times.
Expand All @@ -38,16 +38,16 @@ while [[ $# -gt 0 ]]; do
container_registry_fqdn="$2"
shift 2
;;
--test-connectivity)
test_connectivity=1
--test)
test=1
shift
;;
--tyger-server)
tyger_server=1
--server)
server=1
shift
;;
--buffer-sidecar)
buffer_sidecar=1
--client)
client=1
shift
;;
--helm)
Expand Down Expand Up @@ -119,11 +119,17 @@ export DOCKER_BUILDKIT=1
repo_root_dir="$(dirname "$0")/.."

function build_and_push_platform() {
local build_context="$1"
local dockerfile_path="$2"
local repo="$3"
local platform="$4"
local image_tag_with_platform="${image_tag}-${platform}"

full_image="${container_registry_fqdn}${registry_dir}${repo}:${image_tag_with_platform}"
echo "Building image ${full_image}..."

set +e
output=$(docker buildx build --platform "${platform}" -f "${dockerfile_path}" -t "${full_image}" --target "${target}" --build-arg TYGER_VERSION="${image_tag}" "${build_context}" --provenance false --progress plain 2>&1)
output=$(docker buildx build --platform "${platform}" -f "${dockerfile_path}" -t "${full_image}" --target "${repo}" --build-arg TYGER_VERSION="${image_tag}" "${build_context}" --provenance false --progress plain 2>&1)
ret=$?
set -e
if [[ $ret -ne 0 ]]; then
Expand Down Expand Up @@ -151,16 +157,16 @@ function build_and_push_platform() {
}

function build_and_push() {
local build_context="$1"
local dockerfile_path="$2"
local repo="$3"

if [[ -n "${amd64:-}" ]]; then
platform=amd64
image_tag_with_platform=$"${image_tag}-${platform}"
build_and_push_platform
build_and_push_platform "${build_context}" "${dockerfile_path}" "${repo}" "amd64"
fi

if [[ -n "${arm64:-}" ]]; then
platform=arm64
image_tag_with_platform=$"${image_tag}-${platform}"
build_and_push_platform
build_and_push_platform "${build_context}" "${dockerfile_path}" "${repo}" "arm64"
fi

# if not pushing or not building for both platforms, skip creating a manifest
Expand All @@ -185,51 +191,29 @@ function build_and_push() {
docker manifest push "${manifest_name}" --purge >/dev/null
}

if [[ -n "${test_connectivity:-}" ]]; then
if [[ -n "${test:-}" ]]; then
build_context="${repo_root_dir}/cli"
dockerfile_path="${repo_root_dir}/cli/integrationtest/testconnectivity/Dockerfile"
target="testconnectivity"
repo="testconnectivity"
dockerfile="${repo_root_dir}/cli/integrationtest/testconnectivity/Dockerfile"

build_and_push
build_and_push "${build_context}" "${dockerfile}" "testconnectivity"
fi

if [[ -n "${tyger_server:-}" ]]; then
if [[ -n "${server:-}" ]]; then
build_context="${repo_root_dir}/"
dockerfile_path="${repo_root_dir}/server/Dockerfile"
target="control-plane"
repo="tyger-server"

build_and_push
dockerfile="${repo_root_dir}/server/Dockerfile"

target="data-plane"
repo="tyger-data-plane-server"

build_and_push
build_and_push "${build_context}" "${dockerfile}" "tyger-server"
build_and_push "${build_context}" "${dockerfile}" "tyger-data-plane-server"
fi

if [[ -n "${buffer_sidecar:-}" ]]; then
if [[ -n "${client:-}" ]]; then
build_context="${repo_root_dir}/cli"
dockerfile_path="${repo_root_dir}/cli/Dockerfile"
target="buffer-sidecar"
repo="buffer-sidecar"

build_and_push

target="tyger-cli"
repo="tyger-cli"

build_and_push

target="buffer-copier"
repo="buffer-copier"

build_and_push

target="worker-waiter"
repo="worker-waiter"
dockerfile="${repo_root_dir}/cli/Dockerfile"

build_and_push
build_and_push "${build_context}" "${dockerfile}" "buffer-sidecar"
build_and_push "${build_context}" "${dockerfile}" "tyger-cli"
build_and_push "${build_context}" "${dockerfile}" "buffer-copier"
build_and_push "${build_context}" "${dockerfile}" "worker-waiter"
fi

if [[ -n "${helm:-}" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN dotnet publish --no-restore --arch ${TARGETARCH} -c release -o /data-plane

FROM mcr.microsoft.com/dotnet/aspnet:9.0.11-azurelinux3.0 AS runtime-prep

FROM mcr.microsoft.com/dotnet/aspnet:9.0.11-azurelinux3.0-distroless AS control-plane
FROM mcr.microsoft.com/dotnet/aspnet:9.0.11-azurelinux3.0-distroless AS tyger-server
COPY --from=build /cp /app
WORKDIR /app/bin
COPY --from=runtime-prep /usr/bin/sleep .
Expand All @@ -53,7 +53,7 @@ COPY --from=build /control-plane .
USER app:app
ENTRYPOINT ["/app/bin/tyger-server"]

FROM mcr.microsoft.com/dotnet/aspnet:9.0.11-azurelinux3.0-distroless AS data-plane
FROM mcr.microsoft.com/dotnet/aspnet:9.0.11-azurelinux3.0-distroless AS tyger-data-plane-server
COPY --from=build /dp /app
WORKDIR /app/bin
COPY --from=build /static/curl .
Expand Down
Loading