Minor cleanup & Dockerfile

This commit is contained in:
2025-02-23 13:29:38 -05:00
parent c89d94dd66
commit c95a73401e
8 changed files with 65 additions and 239 deletions

9
scripts/build.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh -e
if ! [ -f Cargo.toml ]; then
echo "This script must be run from the root of the repo."
exit 1
fi
cargo build --release --target x86_64-unknown-linux-gnu
docker build -t "${DOCKER_REGISTRY}/p5x-rs:latest" .

27
scripts/run.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/sh -e
# Build the release binary
echo ""
echo "Building p5x..."
echo ""
./scripts/build.sh
# Create a data volume if one doesn't already exist
if ! docker volume inspect p5x-data >/dev/null; then
docker volume create p5x-data
fi
# Run the docker container for the server (use -it if we have TTY)
P5X_ARGS="-p 3450:3450 --rm --mount source=p5x-data,target=/p5x/data"
if [ -t 1 ]; then
P5X_ARGS="$P5X_ARGS -it"
fi
if [ -f .env ]; then
P5X_ARGS="$P5X_ARGS --env-file .env"
fi
echo ""
echo "Running p5x..."
echo ""
docker run $P5X_ARGS "$DOCKER_REGISTRY/p5x-rs:latest"