Skip to content

Commit edc2420

Browse files
committed
temporary build script until we have CI
1 parent 264e141 commit edc2420

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

build.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
build_no="$1"
4+
build_args="--compress"
5+
tag_prefix="registry.library.oregonstate.edu/osulp-api"
6+
7+
if [ -z "$BCR_PASS" ]; then
8+
echo 'Please set the BCR password in $BCR_PASS'
9+
exit 1
10+
fi
11+
12+
if [ -z "$build_no" ]; then
13+
if [ -f ".version" ]; then
14+
version=`cat .version`
15+
let build_no=($version + 1)
16+
echo "Using cached build number: (old: $version, new: $build_no)"
17+
else
18+
echo "Usage: $0 <build number>"
19+
exit 1
20+
fi
21+
fi
22+
tag1="$tag_prefix:osulp-${build_no}"
23+
tag2="$tag_prefix:latest"
24+
25+
echo "Building for tag $tag1"
26+
docker build ${build_args} . -t "$tag1"
27+
28+
if [ "$?" -eq 0 ]; then
29+
echo "Logging into BCR as admin"
30+
echo $BCR_PASS | docker login --password-stdin registry.library.oregonstate.edu
31+
32+
echo "pushing: $tag1"
33+
docker push "$tag1"
34+
if [ "$?" -eq 0 ]; then
35+
echo $build_no > .version
36+
fi
37+
echo "tagging $tag1 as :latest"
38+
docker tag $tag1 $tag2
39+
docker push "$tag2"
40+
fi

0 commit comments

Comments
 (0)