refractr/build

34 lines
1.1 KiB
Text
Raw Normal View History

#!/bin/sh
2025-03-02 16:13:44 -07:00
# Create all the different builds for refractr
2025-03-02 16:13:44 -07:00
version=$(cat Cargo.toml | grep -m1 version | awk -F' ' '{print $3}' | sed 's|"||g')
major_version=$(echo $version | awk -F'.' '{print $1}')
uid=$(id -u)
gid=$(id -g)
2025-05-12 00:03:54 -06:00
date=$(date -u --rfc-3339=seconds)
cargo=$(which cargo 2> /dev/null)
if [ -n "$cargo" ]; then
cargo update
cargo clean
fi
2025-03-02 16:13:44 -07:00
# docker builds
2025-05-12 00:03:54 -06:00
docker build -t refractr:$version -t refractr:$major_version -t refractr:latest \
--build-arg VERSION=$version --build-arg DATE="$date" -f docker/Dockerfile .
if [ "$1" = "push" ]; then
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:latest
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:$version
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:$major_version
docker push -a git.brysonsteck.xyz/brysonsteck/refractr
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:latest
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:$version
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:$major_version
fi
2025-03-02 16:13:44 -07:00
# rust build
2025-05-12 00:03:54 -06:00
if [ -n "$cargo" ]; then
cargo build
cargo build --release
fi