mirror of https://github.com/breard-r/acmed.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
829 B
41 lines
829 B
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
DIR="$( cd "$( dirname "$0" )/../.." >/dev/null 2>&1 && pwd )"
|
|
|
|
# Parse command line args
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "Usage: $0 <target>"
|
|
echo "Supported targets: stretch, buster"
|
|
exit 1
|
|
fi
|
|
if [ "$1" == "buster" ]; then
|
|
TARGET=buster
|
|
elif [ "$1" == "stretch" ]; then
|
|
TARGET=stretch
|
|
else
|
|
echo "Invalid target: $1"
|
|
exit 1
|
|
fi
|
|
|
|
# Determine image
|
|
IMAGE=rust:1-$TARGET
|
|
|
|
function log {
|
|
echo -e "\033[32;1m==> ${1}\033[0m"
|
|
}
|
|
|
|
# This or commit Dockerfile at project root
|
|
log "Prepare docker build"
|
|
cp $( dirname "$0" )/Dockerfile $DIR
|
|
|
|
cd $DIR
|
|
|
|
log "Build docker image"
|
|
docker build -t acmed:$TARGET --build-arg TARGET=$TARGET .
|
|
|
|
log "Successfully built image, Cleanup"
|
|
|
|
rm Dockerfile
|
|
|
|
log "Done! Find your binaries in the /usr/local/bin directory of image acmed:$TARGET."
|