Skip to content

Commit

Permalink
feat: setup script for build container image
Browse files Browse the repository at this point in the history
Signed-off-by: Zhou Zhiqiang <[email protected]>
  • Loading branch information
STRRL committed Mar 4, 2024
1 parent 4bdb49e commit 5de8308
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
21 changes: 21 additions & 0 deletions hack/build-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -exo pipefail

echo ${FEATURES}

DIR=$(dirname $0)

COMMIT_HASH=$(bash "${DIR}"/commit-hash.sh)

cd ${DIR}/../ && \
DOCKER_BUILDKIT=1 docker build -t ghcr.io/limit-lab/unollm_next:"${COMMIT_HASH}" \
--build-arg GITHUB_USERNAME="${GITHUB_USERNAME}" \
--build-arg GITHUB_TOKEN="${GITHUB_TOKEN}" \
-f ./Dockerfile ./

docker tag ghcr.io/limit-lab/unollm_next:"${COMMIT_HASH}" ghcr.io/limit-lab/unollm_next:latest

if [ ! -z ${IMAGE_TAG} ]; then
docker tag ghcr.io/limit-lab/unollm_next:"${COMMIT_HASH}" ghcr.io/limit-lab/unollm_next:${IMAGE_TAG}
fi
10 changes: 10 additions & 0 deletions hack/commit-hash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -euxo pipefail

HASH=$(git rev-list -1 HEAD --abbrev-commit)
if [[ $(git status --porcelain) ]]; then
HASH=${HASH}-dirty
fi

echo $HASH

0 comments on commit 5de8308

Please sign in to comment.