forked from Marker-Inc-Korea/AutoRAG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_and_push.sh
executable file
·39 lines (31 loc) · 1.14 KB
/
build_and_push.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Check if version is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <version>"
exit 1
fi
VERSION=$1
DOCKER_REPO="autoraghq/autorag"
# Array of variants
variants=("ja" "ko" "dev" "parsing" "api")
# Build and push for each variant
for variant in "${variants[@]}"
do
echo "Building $DOCKER_REPO:$VERSION-$variant"
docker build --build-arg TARGET_STAGE=$variant -t $DOCKER_REPO:$VERSION-$variant -f ./docker/base/Dockerfile .
echo "Pushing $DOCKER_REPO:$VERSION-$variant"
docker push $DOCKER_REPO:$VERSION-$variant
# If it's a release build, also tag and push as latest for that variant
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tagging and pushing $DOCKER_REPO:$variant"
docker tag $DOCKER_REPO:$VERSION-$variant $DOCKER_REPO:$variant
docker push $DOCKER_REPO:$variant
fi
done
# Special handling for 'production' as 'all'
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tagging and pushing $DOCKER_REPO:all"
docker tag $DOCKER_REPO:$VERSION-production $DOCKER_REPO:all
docker push $DOCKER_REPO:all
fi
echo "Build and push complete for all variants"