FrostByte/justfile

73 lines
2.2 KiB
Makefile
Raw Normal View History

2023-10-20 00:56:57 +02:00
runtime := "podman"
# Builds a debug container and runs it
dev: start-debug
@echo "Cd into client and run 'npm run dev' to start the client in dev mode."
2023-10-21 05:11:42 +02:00
[private]
2023-10-20 00:56:57 +02:00
npm-install directory:
cd {{directory}} && npm install
# Builds the client with npm (result in client/dist)
2023-10-20 00:56:57 +02:00
[private]
2023-10-21 05:11:42 +02:00
npm-build directory: (npm-install directory)
cd {{directory}} && npm run build
@echo "Built client at {{directory}}/dist"
# Builds a debug container
2023-10-20 00:56:57 +02:00
[private]
build-container-server-debug:
{{runtime}} build -t fb-server-debug -f container/ContainerfileDebug .
# Builds a debug container and runs it
2023-10-20 00:56:57 +02:00
[private]
start-debug: build-container-server-debug remove-podman-containers
{{runtime}} run -d -p 8080:8080 --name frostbyte-debug fb-server-debug
@echo "Debug server started."
# Builds a release container
2023-10-20 00:56:57 +02:00
[private]
build-container-release:
{{runtime}} build -t fb-server -f container/Containerfile .
# Builds a release container and runs it
2023-10-20 00:56:57 +02:00
start-release: build-container-release remove-podman-containers
{{runtime}} run -d -p 8080:8080 --name frostbyte fb-server
init-sqlx:
echo "DATABASE_URL=sqlite:debug.db" > server/.env
cd server && sqlx database create
cd server && sqlx migrate run
cd server && cargo sqlx prepare
2023-10-20 00:56:57 +02:00
# Removes and stops any containers related to the project
[private]
remove-podman-containers:
{{runtime}} container rm -f frostbyte
{{runtime}} container rm -f frostbyte-debug
# Deletes everything podman related (even unrelated to the project)
2023-10-20 00:56:57 +02:00
[private]
prune-podman:
2023-10-20 00:56:57 +02:00
{{runtime}} stop -a
{{runtime}} rm -af
{{runtime}} image rm -af
{{runtime}} system prune -af
{{runtime}} system reset --force
# Cleans up everything related to the project
clean:
2023-10-20 00:56:57 +02:00
{{runtime}} container rm -f frostbyte
{{runtime}} container rm -f frostbyte-debug
{{runtime}} image rm -f fb-server
{{runtime}} image rm -f fb-server-debug
rm -rf client/dist
rm -rf client/node_modules
rm -rf server/public
rm -rf server/target
2023-10-20 00:56:57 +02:00
@echo "Cleaned up! Make sure to run 'just nuke' to nuke everything podman related."
# Nukes everything. No mercy. Leave no trace.
nuke: clean prune-podman
@echo "Nuked everything! You're starting from scratch now."