added Dockerfile & added --port --domain --skip-config-check flags

This commit is contained in:
partisan 2024-11-21 12:30:16 +01:00
parent 3ca7d57680
commit 28f71271d7
5 changed files with 249 additions and 18 deletions

41
run.sh
View file

@ -1,7 +1,42 @@
#!/bin/sh
# List all go files in this directory
# Initialize variables
SKIP_CONFIG=""
PORT=""
DOMAIN=""
# Parse arguments
while [ $# -gt 0 ]; do
case $1 in
--port)
PORT=$2
shift 2
;;
--domain)
DOMAIN=$2
shift 2
;;
--skip-config-check)
SKIP_CONFIG="--skip-config-check"
shift
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
# List all Go files in this directory
GO_FILES=$(find . -name '*.go' -print)
# Run the Go program with the specified files first, followed by the remaining files
go run $FILES $GO_FILES
# Construct the command
CMD="go run $GO_FILES $SKIP_CONFIG"
[ -n "$PORT" ] && CMD="$CMD --port $PORT"
[ -n "$DOMAIN" ] && CMD="$CMD --domain $DOMAIN"
# Informative output
echo "Starting application with command: $CMD"
# Run the Go program with the constructed command
eval $CMD