Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
4eUeP committed Feb 28, 2024
1 parent 1c3292e commit 189a87c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ COPY --from=ghcr.io/hstreamdb/grpc:1.54.2 /usr/local/lib/ /usr/local/lib/
COPY requirements/ /tmp/requirements/
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
$(cat /tmp/requirements/ubuntu-jammy.txt) && \
$(cat /tmp/requirements/ubuntu-jammy.txt) libjemalloc2 && \
rm -rf /tmp/requirements && rm -rf /var/lib/apt/lists/* && apt-get clean

COPY --from=ld_client /usr/local/lib/ /usr/local/lib/
COPY --from=ld_client /usr/local/include/ /usr/local/include/
COPY --from=ld_client /usr/lib/libjemalloc.so.2 /usr/lib/
RUN ln -sr /usr/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so && \

RUN \
[ -f "/usr/local/include/thrift/lib/thrift/gen-cpp2/RpcMetadata_types.h" ] && \
# temporary fix of "cabal build --enable-profiling" \
sed -i '/^#pragma once/a #ifdef PROFILING\n#undef PROFILING\n#endif' /usr/local/include/thrift/lib/thrift/gen-cpp2/RpcMetadata_types.h
Expand Down
38 changes: 30 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,30 @@ _buildx() {
dockerfile="$1"
image_name="$2"
target="$3"
tag="$4"
tags="$4" # can be multiple, e.g. "tag1 tag2"
# Optional
build_args="$5"

test -n "$target" && target="--target $target"
metadata_file=$(mktemp)

# build and push digest
docker buildx build \
--file $dockerfile \
$target \
$target $build_args \
--output type=image,name=$image_name,push-by-digest=true,name-canonical=true,push=true \
--metadata-file $metadata_file \
.
digest=$(python3 -c "import json; d = json.load(open('$metadata_file')); print(d['containerimage.digest'])")

# writes to local image store, so it will appear in `docker images`
docker buildx build \
--file $dockerfile $target \
--output type=docker,name=$image_name:$tag .
# [Optional] writes to local image store, so it will appear in `docker images`
for tag in $tags; do
docker buildx build \
--file $dockerfile $target $build_args \
--output type=docker,name=$image_name:$tag .
done

# create tag from digests
# Push tag from digests
#
# TODO: update digest for the architecture
#
Expand All @@ -90,8 +95,11 @@ _buildx() {
# if m['platform']['architecture'] == ...
# "
# x=$(python3 -c "$parse_manifests")
for tag in $tags; do
tag_param="$tag_param --tag $image_name:$tag"
done
docker buildx imagetools create \
--tag $image_name:$tag \
$tag_param \
$image_name@$digest
}

Expand Down Expand Up @@ -151,6 +159,18 @@ hadmin_store() {
_buildx "dockerfiles/hadmin_store" "ghcr.io/hstreamdb/hadmin-store" "" "latest"
}

haskell() {
haskell810
}

haskell810() {
cd $HS_DIR

_buildx "Dockerfile" "hstreamdb/haskell" \
"" "8.10.7 8.10" \
"--build-arg GHC=8.10.7 --build-arg LD_CLIENT_IMAGE=hstreamdb/logdevice-client"
}

# -----------------------------------------------------------------------------
# Outdated
#
Expand Down Expand Up @@ -349,6 +369,7 @@ push_ghc_latest_manifest() {
}

# -----------------------------------------------------------------------------
# Outdated, TODO: remove

build_hsthrift() {
cd $HS_DIR
Expand All @@ -368,6 +389,7 @@ push_hsthrift_manifest() {
}

# -----------------------------------------------------------------------------
# Outdated, TODO: remove

build_hadmin_store() {
cd $HS_DIR
Expand Down

0 comments on commit 189a87c

Please sign in to comment.