scribe/script/build_static

21 wiersze
657 B
Bash
Executable File

#!/usr/bin/env bash
# Exit if any subcommand fails
set -e
set -o pipefail
todays_date=$(date "+%Y-%m-%d")
if ! git show HEAD:src/version.cr | rg -q $todays_date; then
echo "Date in committed src/version.cr is not today's date ($todays_date)"
echo "Make sure that the file is both up to date and commited to git."
echo
echo "## src/version.cr"
git show HEAD:src/version.cr
# exit 1
fi
# Via: https://crystal-lang.org/reference/1.10/guides/static_linking.html#linux
~/.docker/bin/docker run --rm -it -v $(pwd):/workspace -w /workspace crystallang/crystal:latest-alpine \
crystal build src/start_server.cr -o ubuntu_server --static --release